X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flibpspp%2Fcompiler.h;h=6ce8f1aecb41f89e94f48ca3a0b03b9db42f68cc;hb=08bfd1f8740fbf71e7d9671bb77ee9b234dbc9b8;hp=d22819446f5e5ee7a5eececf9c4f0e3ef261e758;hpb=6a36028028904e2e180aad4c6cf51bb109d2ff16;p=pspp diff --git a/src/libpspp/compiler.h b/src/libpspp/compiler.h index d22819446f..6ce8f1aecb 100644 --- a/src/libpspp/compiler.h +++ b/src/libpspp/compiler.h @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2006, 2009 Free Software Foundation, Inc. + Copyright (C) 2006, 2009, 2010, 2016 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -38,7 +38,11 @@ /* Mark a function as taking a printf- or scanf-like format string as its FMT'th argument and that the FIRST'th argument is the first one to be checked against the format string. */ +#if defined(__GNUC__) && ((__GNUC__ == 4 && __GNUC_MINOR__>= 4) || __GNUC__ > 4) +#define PRINTF_FORMAT(FMT, FIRST) ATTRIBUTE ((format (gnu_printf, FMT, FIRST))) +#else #define PRINTF_FORMAT(FMT, FIRST) ATTRIBUTE ((format (__printf__, FMT, FIRST))) +#endif #define SCANF_FORMAT(FMT, FIRST) ATTRIBUTE ((format (__scanf__, FMT, FIRST))) /* Tells the compiler that a function may be treated as if any @@ -77,4 +81,25 @@ #define PURE_FUNCTION #endif +/* This attribute indicates that the argument with the given + IDX must be a null pointer. IDX counts backward in the + argument list, so that 0 is the last argument, 1 is the + second-from-last argument, and so on. */ +#if __GNUC__ > 3 +#define SENTINEL(IDX) ATTRIBUTE ((sentinel(IDX))) +#else +#define SENTINEL(IDX) +#endif + + +/* This attribute indicates that the function should be compiled + with the specified LEVEL, regardless of what has been specified + on the command line */ +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR >= 4) +#define OPTIMIZE(LEVEL) ATTRIBUTE ((optimize(LEVEL))) +#else +#define OPTIMIZE(LEVEL) +#endif + + #endif /* compiler.h */