6 * compiler - macros for common compiler extensions
8 * Abstracts away some compiler hints. Currently these include:
10 * For functions not called in fast paths (aka. cold functions)
12 * For functions which take printf-style parameters.
14 * For functions which return the same value for same parameters.
16 * For functions and variables which must be emitted even if unused.
18 * For functions and variables which need not be emitted if unused.
20 * For parameters which are not used.
21 * - IS_COMPILE_CONSTANT()
22 * For using different tradeoffs for compiletime vs runtime evaluation.
24 * License: CC0 (Public domain)
25 * Author: Rusty Russell <rusty@rustcorp.com.au>
28 * #include <ccan/compiler/compiler.h>
32 * // Example of a (slow-path) logging function.
33 * static int log_threshold = 2;
34 * static void COLD PRINTF_FMT(2,3)
35 * logger(int level, const char *fmt, ...)
39 * if (level >= log_threshold)
40 * vfprintf(stderr, fmt, ap);
44 * int main(int argc, char *argv[])
47 * logger(3, "Don't want %i arguments!\n", argc-1);
53 int main(int argc, char *argv[])
55 /* Expect exactly one argument */
59 if (strcmp(argv[1], "depends") == 0) {