From 18168d54c3e14ee4225cdfc853fcc78beb971664 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Tue, 8 Mar 2022 11:57:09 -0800 Subject: [PATCH] lib: simplify pragma macros --- .../libvapours/include/vapours/freebsd/tree.hpp | 2 +- .../include/vapours/impl/compiler_impl.clang.hpp | 3 +-- .../include/vapours/impl/compiler_impl.gcc.hpp | 12 ++++-------- .../include/vapours/util/util_intrusive_list.hpp | 2 +- .../vapours/util/util_intrusive_red_black_tree.hpp | 2 +- .../libvapours/source/util/util_format_string.cpp | 2 +- 6 files changed, 9 insertions(+), 14 deletions(-) diff --git a/libraries/libvapours/include/vapours/freebsd/tree.hpp b/libraries/libvapours/include/vapours/freebsd/tree.hpp index 2dcab2fb6..cf0c3f452 100644 --- a/libraries/libvapours/include/vapours/freebsd/tree.hpp +++ b/libraries/libvapours/include/vapours/freebsd/tree.hpp @@ -30,7 +30,7 @@ #include #include -AMS_PRAGMA_BEGIN_OPTIMIZE_O3() +AMS_PRAGMA_BEGIN_OPTIMIZE("-O3") /* * This file defines data structures for red-black trees. diff --git a/libraries/libvapours/include/vapours/impl/compiler_impl.clang.hpp b/libraries/libvapours/include/vapours/impl/compiler_impl.clang.hpp index 607366c7f..febf74d34 100644 --- a/libraries/libvapours/include/vapours/impl/compiler_impl.clang.hpp +++ b/libraries/libvapours/include/vapours/impl/compiler_impl.clang.hpp @@ -20,8 +20,7 @@ #define AMS_PRAGMA(X) \ _Pragma(#X) -#define AMS_PRAGMA_BEGIN_OPTIMIZE_O3() -#define AMS_PRAGMA_BEGIN_OPTIMIZE_OS() +#define AMS_PRAGMA_BEGIN_OPTIMIZE(X) #define AMS_PRAGMA_END_OPTIMIZE() #define AMS_PRAGMA_BEGIN_PACK(n) \ diff --git a/libraries/libvapours/include/vapours/impl/compiler_impl.gcc.hpp b/libraries/libvapours/include/vapours/impl/compiler_impl.gcc.hpp index 481045801..3cab082b1 100644 --- a/libraries/libvapours/include/vapours/impl/compiler_impl.gcc.hpp +++ b/libraries/libvapours/include/vapours/impl/compiler_impl.gcc.hpp @@ -20,16 +20,12 @@ #define AMS_PRAGMA(X) \ _Pragma(#X) -#define AMS_PRAGMA_BEGIN_OPTIMIZE_O3() \ - _Pragma("GCC push_options") \ - _Pragma("GCC optimize (\"-O3\")") - -#define AMS_PRAGMA_BEGIN_OPTIMIZE_OS() \ - _Pragma("GCC push_options") \ - _Pragma("GCC optimize (\"-Os\")") +#define AMS_PRAGMA_BEGIN_OPTIMIZE(X) \ + AMS_PRAGMA(GCC push_options) \ + AMS_PRAGMA(GCC optimize(X)) #define AMS_PRAGMA_END_OPTIMIZE() \ - _Pragma("GCC pop_options") + AMS_PRAGMA(GCC pop_options) #define AMS_PRAGMA_BEGIN_PACK(n) \ AMS_PRAGMA(pack(push, n)) diff --git a/libraries/libvapours/include/vapours/util/util_intrusive_list.hpp b/libraries/libvapours/include/vapours/util/util_intrusive_list.hpp index 271db8c07..783117bec 100644 --- a/libraries/libvapours/include/vapours/util/util_intrusive_list.hpp +++ b/libraries/libvapours/include/vapours/util/util_intrusive_list.hpp @@ -21,7 +21,7 @@ namespace ams::util { - AMS_PRAGMA_BEGIN_OPTIMIZE_O3() + AMS_PRAGMA_BEGIN_OPTIMIZE("-O3") /* Forward declare implementation class for Node. */ namespace impl { diff --git a/libraries/libvapours/include/vapours/util/util_intrusive_red_black_tree.hpp b/libraries/libvapours/include/vapours/util/util_intrusive_red_black_tree.hpp index e8a3963e4..a25f0b783 100644 --- a/libraries/libvapours/include/vapours/util/util_intrusive_red_black_tree.hpp +++ b/libraries/libvapours/include/vapours/util/util_intrusive_red_black_tree.hpp @@ -22,7 +22,7 @@ namespace ams::util { - AMS_PRAGMA_BEGIN_OPTIMIZE_O3() + AMS_PRAGMA_BEGIN_OPTIMIZE("-O3") namespace impl { diff --git a/libraries/libvapours/source/util/util_format_string.cpp b/libraries/libvapours/source/util/util_format_string.cpp index e27bb4457..312d09062 100644 --- a/libraries/libvapours/source/util/util_format_string.cpp +++ b/libraries/libvapours/source/util/util_format_string.cpp @@ -17,7 +17,7 @@ namespace ams::util { - AMS_PRAGMA_BEGIN_OPTIMIZE_O3() + AMS_PRAGMA_BEGIN_OPTIMIZE("-Os") namespace {