1 /* PSPP - a program for statistical analysis.
2 Copyright (C) 2006, 2009 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 #define PRINTF_FORMAT(FMT, FIRST) ATTRIBUTE ((format (__printf__, FMT, FIRST)))
42 #define SCANF_FORMAT(FMT, FIRST) ATTRIBUTE ((format (__scanf__, FMT, FIRST)))
44 /* Tells the compiler that a function may be treated as if any
45 non-`NULL' pointer it returns cannot alias any other pointer
46 valid when the function returns. */
48 #define MALLOC_LIKE ATTRIBUTE ((__malloc__))
53 /* This attribute was added in GCC 4.0. */
55 #define WARN_UNUSED_RESULT ATTRIBUTE ((warn_unused_result))
57 #define WARN_UNUSED_RESULT
60 /* This attribute indicates that the function does not examine
61 any values except its arguments, and has no effects except the
62 return value. A function that has pointer arguments and
63 examines the data pointed to must _not_ be declared
65 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5)
66 #define CONST_FUNCTION ATTRIBUTE ((const))
68 #define CONST_FUNCTION
71 /* This attribute indicates that the function has no effects
72 except the return value and its return value depends only on
73 the parameters and/or global variables. */
75 #define PURE_FUNCTION ATTRIBUTE ((pure))
80 /* This attribute indicates that the argument with the given
81 IDX must be a null pointer. IDX counts backward in the
82 argument list, so that 0 is the last argument, 1 is the
83 second-from-last argument, and so on. */
85 #define SENTINEL(IDX) ATTRIBUTE ((sentinel(IDX)))
90 #endif /* compiler.h */