Add __PRAGMA_WARNING for inserting warnings.

This commit is contained in:
Jonas 'Sortie' Termansen 2013-03-22 18:47:38 +01:00
parent cc5302af31
commit 46b86892de
1 changed files with 16 additions and 1 deletions

View File

@ -1,6 +1,6 @@
/*******************************************************************************
Copyright(C) Jonas 'Sortie' Termansen 2011.
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013.
This file is part of the Sortix C Library.
@ -25,6 +25,21 @@
#ifndef _FEATURES_H
#define _FEATURES_H 1
/* Support macro to ease testing the compiler version. */
#define __GCC_PREREQ(gcc_major, gcc_minor) \
(((gcc_major) == __GNUC__ && (gcc_minor) >= __GNUC_MINOR__) || \
((gcc_major) < __GNUC__))
/* Preprocessor trick to turn anything into a string. */
#define __STRINGIFY(x) #x
/* Issue warning when this is used, except in defines, where the warning is
inserted whenever the macro is expanded. This can be used to deprecated
macros - and it happens on preprocessor level - so it shouldn't change any
semantics of any code that uses such a macro. The argument msg should be a
string that contains the warning. */
#define __PRAGMA_WARNING(msg) _Pragma(__STRINGIFY(GCC warning msg))
/* C++ needs to know that types and declarations are C, not C++. */
#ifdef __cplusplus
#define __BEGIN_DECLS extern "C" {