diff options
author | 卜部昌平 <shyouhei@ruby-lang.org> | 2020-04-08 13:28:13 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-08 13:28:13 +0900 |
commit | 9e6e39c3512f7a962c44dc3729c98a0f8be90341 (patch) | |
tree | 901a22676d54d78240e450b64a8cd06eb1703910 /internal/warnings.h | |
parent | 5ac4bf2cd87e1eb5779ca5ae7f96a1a22e8436d9 (diff) | |
download | ruby-9e6e39c3512f7a962c44dc3729c98a0f8be90341.tar.gz |
Merge pull request #2991 from shyouhei/ruby.h
Split ruby.h
Diffstat (limited to 'internal/warnings.h')
-rw-r--r-- | internal/warnings.h | 52 |
1 files changed, 10 insertions, 42 deletions
diff --git a/internal/warnings.h b/internal/warnings.h index 82b3ac59c7..a1705a6867 100644 --- a/internal/warnings.h +++ b/internal/warnings.h @@ -1,49 +1,17 @@ -#ifndef INTERNAL_WARNINGS_H /* -*- C -*- */ -#define INTERNAL_WARNINGS_H -/** +/** \noop-*-C-*-vi:ft=c * @file - * @brief Internal header to suppress / mandate warnings. - * @author \@shyouhei + * @author Ruby developers <ruby-core@ruby-lang.org> * @copyright This file is a part of the programming language Ruby. * Permission is hereby granted, to either redistribute and/or * modify this file, provided that the conditions mentioned in the * file COPYING are met. Consult the file for details. + * @brief Internal header to suppres / mandate warnings. */ -#include "internal/compilers.h" /* for MSC_VERSION_SINCE */ - -#if MSC_VERSION_SINCE(1200) -# /* Not sure exactly when but it seems VC++ 6.0 is a version with it.*/ -# define COMPILER_WARNING_PUSH __pragma(warning(push)) -# define COMPILER_WARNING_POP __pragma(warning(pop)) -# define COMPILER_WARNING_ERROR(flag) __pragma(warning(error: flag)) -# define COMPILER_WARNING_IGNORED(flag) __pragma(warning(disable: flag)) - -#elif defined(__clang__) -# /* Not sure exactly when but it seems LLVM 2.6.0 is a version with it. */ -# define COMPILER_WARNING_PRAGMA0(x) _Pragma(# x) -# define COMPILER_WARNING_PRAGMA1(x) COMPILER_WARNING_PRAGMA0(clang diagnostic x) -# define COMPILER_WARNING_PRAGMA2(x, y) COMPILER_WARNING_PRAGMA1(x # y) -# define COMPILER_WARNING_PUSH COMPILER_WARNING_PRAGMA1(push) -# define COMPILER_WARNING_POP COMPILER_WARNING_PRAGMA1(pop) -# define COMPILER_WARNING_ERROR(flag) COMPILER_WARNING_PRAGMA2(error, flag) -# define COMPILER_WARNING_IGNORED(flag) COMPILER_WARNING_PRAGMA2(ignored, flag) - -#elif GCC_VERSION_SINCE(4, 6, 0) -# /* https://gcc.gnu.org/onlinedocs/gcc-4.6.0/gcc/Diagnostic-Pragmas.html */ -# define COMPILER_WARNING_PRAGMA0(x) _Pragma(# x) -# define COMPILER_WARNING_PRAGMA1(x) COMPILER_WARNING_PRAGMA0(GCC diagnostic x) -# define COMPILER_WARNING_PRAGMA2(x, y) COMPILER_WARNING_PRAGMA1(x # y) -# define COMPILER_WARNING_PUSH COMPILER_WARNING_PRAGMA1(push) -# define COMPILER_WARNING_POP COMPILER_WARNING_PRAGMA1(pop) -# define COMPILER_WARNING_ERROR(flag) COMPILER_WARNING_PRAGMA2(error, flag) -# define COMPILER_WARNING_IGNORED(flag) COMPILER_WARNING_PRAGMA2(ignored, flag) - -#else -# /* :FIXME: improve here, for instace icc seems to have something? */ -# define COMPILER_WARNING_PUSH /* void */ -# define COMPILER_WARNING_POP /* void */ -# define COMPILER_WARNING_ERROR(flag) /* void */ -# define COMPILER_WARNING_IGNORED(flag) /* void */ - -#endif /* _MSC_VER */ +#ifndef INTERNAL_WARNINGS_H +#define INTERNAL_WARNINGS_H +#include "ruby/3/warning_push.h" +#define COMPILER_WARNING_PUSH RUBY3_WARNING_PUSH() +#define COMPILER_WARNING_POP RUBY3_WARNING_POP() +#define COMPILER_WARNING_ERROR(flag) RUBY3_WARNING_ERROR(flag) +#define COMPILER_WARNING_IGNORED(flag) RUBY3_WARNING_IGNORED(flag) #endif /* INTERNAL_WARNINGS_H */ |