1 /* PSPP - a program for statistical analysis.
2 Copyright (C) 2006, 2009, 2010, 2016 Free Software Foundation, Inc.
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 /* GNU C allows the programmer to declare that certain functions take
21 printf-like arguments, never return, etc. Conditionalize these
22 declarations on whether gcc is in use. */
24 #define ATTRIBUTE(X) __attribute__ (X)
26 /* Only necessary because of a wart in gnulib's xalloc.h. */
27 #define __attribute__(X) __attribute__ (X)
32 /* Marks a function argument as possibly not used. */
33 #define UNUSED ATTRIBUTE ((unused))
35 /* Marks a function that will never return. */
36 #define NO_RETURN ATTRIBUTE ((noreturn))
38 /* Mark a function as taking a printf- or scanf-like format
39 string as its FMT'th argument and that the FIRST'th argument
40 is the first one to be checked against the format string. */
41 #if defined(__GNUC__) && ((__GNUC__ == 4 && __GNUC_MINOR__>= 4) || __GNUC__ > 4)
42 #define PRINTF_FORMAT(FMT, FIRST) ATTRIBUTE ((format (gnu_printf, FMT, FIRST)))
44 #define PRINTF_FORMAT(FMT, FIRST) ATTRIBUTE ((format (__printf__, FMT, FIRST)))
46 #define SCANF_FORMAT(FMT, FIRST) ATTRIBUTE ((format (__scanf__, FMT, FIRST)))
48 /* Tells the compiler that a function may be treated as if any
49 non-`NULL' pointer it returns cannot alias any other pointer
50 valid when the function returns. */
52 #define MALLOC_LIKE ATTRIBUTE ((__malloc__))
57 /* This attribute was added in GCC 4.0. */
59 #define WARN_UNUSED_RESULT ATTRIBUTE ((warn_unused_result))
61 #define WARN_UNUSED_RESULT
64 /* This attribute indicates that the function does not examine
65 any values except its arguments, and has no effects except the
66 return value. A function that has pointer arguments and
67 examines the data pointed to must _not_ be declared
69 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5)
70 #define CONST_FUNCTION ATTRIBUTE ((const))
72 #define CONST_FUNCTION
75 /* This attribute indicates that the function has no effects
76 except the return value and its return value depends only on
77 the parameters and/or global variables. */
79 #define PURE_FUNCTION ATTRIBUTE ((pure))
84 /* This attribute indicates that the argument with the given
85 IDX must be a null pointer. IDX counts backward in the
86 argument list, so that 0 is the last argument, 1 is the
87 second-from-last argument, and so on. */
89 #define SENTINEL(IDX) ATTRIBUTE ((sentinel(IDX)))
95 /* This attribute indicates that the function should be compiled
96 with the specified LEVEL, regardless of what has been specified
97 on the command line */
98 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR >= 4)
99 #define OPTIMIZE(LEVEL) ATTRIBUTE ((optimize(LEVEL)))
101 #define OPTIMIZE(LEVEL)
105 #endif /* compiler.h */