changeset 1922f9d2ac01 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=1922f9d2ac01
description:
base: Add compiler macros to add deprecation warnings
Gcc and clang both provide an attribute that can be used to flag a
function as deprecated at compile time. This changeset adds a gem5
compiler macro for that compiler feature. The macro can be used to
indicate that a legacy API within gem5 has been deprecated and provide
a graceful migration to the new API.
diffstat:
src/SConscript | 7 ++++++-
src/base/compiler.hh | 2 ++
2 files changed, 8 insertions(+), 1 deletions(-)
diffs (29 lines):
diff -r a24286e33318 -r 1922f9d2ac01 src/SConscript
--- a/src/SConscript Wed Feb 11 10:23:23 2015 -0500
+++ b/src/SConscript Wed Feb 11 10:23:24 2015 -0500
@@ -1061,7 +1061,12 @@
new_env.Append(LINKFLAGS='-fsanitize=undefined')
werror_env = new_env.Clone()
- werror_env.Append(CCFLAGS='-Werror')
+ # Treat warnings as errors but white list some warnings that we
+ # want to allow (e.g., deprecation warnings).
+ werror_env.Append(CCFLAGS=['-Werror',
+ '-Wno-error=deprecated-declarations',
+ '-Wno-error=deprecated',
+ ])
def make_obj(source, static, extra_deps = None):
'''This function adds the specified source to the correct
diff -r a24286e33318 -r 1922f9d2ac01 src/base/compiler.hh
--- a/src/base/compiler.hh Wed Feb 11 10:23:23 2015 -0500
+++ b/src/base/compiler.hh Wed Feb 11 10:23:24 2015 -0500
@@ -80,6 +80,8 @@
# define M5_VAR_USED __attribute__((unused))
# define M5_ATTR_PACKED __attribute__ ((__packed__))
# define M5_NO_INLINE __attribute__ ((__noinline__))
+# define M5_DEPRECATED __attribute__((deprecated))
+# define M5_DEPRECATED_MSG(MSG) __attribute__((deprecated(MSG)))
#endif
#if defined(__clang__)
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev