P99
Macros | Typedefs
p99_compiler.h File Reference

Group compiler dependencies together in one file. More...

#include "p99_args.h"
#include "p99_libc.h"
+ Include dependency graph for p99_compiler.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define __has_attribute(X)   p00_has_attribute_ ## X
 
#define __has_builtin(X)   p00_has_builtin_ ## X
 
#define __has_extension   __has_feature
 
#define __has_feature(X)   p00_has_feature_ ## X
 
#define _Alignof(T)   offsetof(struct { char p00_c; T p00_t; }, p00_t)
 
#define _Noreturn
 Declare a function that doesn't return to the caller. More...
 
#define _Thread_local
 The C11 keyword for declaring a thread-local variable. More...
 
#define alignas   _Alignas
 Align an object according to X. More...
 
#define alignof   _Alignof
 Return the alignment requirement for type T. More...
 
#define noreturn
 Declare a function that doesn't return to the caller. More...
 
#define P99_ATLEAST   static
 Specify for array parameters that they have a least a given number of elements. More...
 
#define P99_CONST_FUNCTION
 On architectures that support this, assert that a function is "const", i.e only depends on parameters and global variables. More...
 
#define P99_DEPRECATED(...)   /*! \deprecated __VA_ARGS__ */
 Deprecate a declaration that is given as the argument list. More...
 
#define P99_EXPECT(EXP, VAL)   (EXP)
 Provide a compiler hint concerning the likelihood of a certain value in an expression EXP. More...
 
#define p99_extension
 Mark an expression as using a compiler extension. More...
 
#define P99_FIXED_REGISTER(REG)
 Fix a variable to a specific register, if the platform supports this. More...
 
#define p99_has_attribute(X)   (__has_attribute(X) || p00_has_attribute_ ## X)
 
#define p99_has_builtin(X)   (__has_builtin(X) || p00_has_builtin_ ## X)
 
#define p99_has_extension(X)   (__has_extension(X) || p00_has_extension_ ## X)
 
#define p99_has_feature(X)   (__has_feature(X) || p00_has_feature_ ## X)
 
#define P99_IF_COMPILER(COMP, ...)   P00_COMPILER_PRAGMA_ ## COMP(P99_STRINGIFY(__VA_ARGS__))
 Issue the pragma that is given as a supplementary argument iff the actual compiler is COMP. More...
 
#define p99_inline   static inline
 Try to force a function always to be inlined. More...
 
#define P99_LIKELY(...)   P99_EXPECT(!!(__VA_ARGS__), 1)
 Mark the conditional expression as being likely. More...
 
#define P99_MACRO_END(...)   extern void P99_PASTE(p00_harmless_declaration_, __VA_ARGS__)(void)
 A meta macro that forces the addition of a semicolon after a call to the macro that it terminates. More...
 
#define P99_PARALLEL_PRAGMA
 A token sequence that can be used in a #pragma directive to indicate a parallel for-loop. More...
 
#define P99_PURE_FUNCTION
 On architectures that support this, assert that a function is "pure", i.e only depends on parameters and global variables. More...
 
#define P99_SETJMP_INLINE(NAME)   P99_WEAK(NAME)
 
#define P99_STRINGIFY(...)   P00_STRINGIFY(__VA_ARGS__)
 Transform the argument list into one string. More...
 
#define P99_TENTATIVE_DEC(T, NAME)   P00_TENTATIVE_DEC(NAME) T NAME
 A tentative declaration of an object NAME of type T. More...
 
#define P99_TENTATIVE_DEF(T, NAME)   P00_TENTATIVE_DEF(NAME) T NAME
 
#define P99_UNLIKELY(...)   P99_EXPECT(!!(__VA_ARGS__), 0)
 Mark the conditional expression as being unlikely. More...
 
#define P99_VECTOR(T, NAME, N)   _Alignas(sizeof(T)*(N)) T NAME[N]
 A wrapper for vector type extensions. More...
 
#define P99_WARN_UNUSED_RESULT
 On architectures that support this, warn if the result of a function is not used. More...
 
#define P99_WEAK(...)   P99_IF_LT(P99_NARG(__VA_ARGS__), 2)(P00_WEAK1(__VA_ARGS__))(P00_WEAK2(__VA_ARGS__))
 Declare a symbol to be weak such that it can be provided several times without error. More...
 
#define static_assert(EXPR, DIAGSTR)
 Evaluate expression EXPR at compile time and ensure that it is fulfilled. More...
 
#define static_inline   static inline
 
#define thread_local
 Declare a thread-local variable. More...
 

Typedefs

typedef union max_align_t max_align_t
 A type with the maximum alignment among the standard types. More...
 

Detailed Description

Group compiler dependencies together in one file.

This has been tested with different versions of gcc (GNU, versions 4.0 to 4.4), clang, opencc (OPEN64) and icc (INTEL).

Definition in file p99_compiler.h.

P99_STRINGIFY
#define P99_STRINGIFY(...)
Transform the argument list into one string.
Definition: p99_compiler.h:109
P99_WEAK
#define P99_WEAK(...)
Declare a symbol to be weak such that it can be provided several times without error.
Definition: p99_compiler.h:561