X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Fcompiler%2F_info;h=12cb24757829b55d339ed6f9e540834d84eac9d3;hp=ea4fe702857155cedf9825501955199b1c656da8;hb=HEAD;hpb=89f1301ed2b65cdb4730bb28c42428873a69faec diff --git a/ccan/compiler/_info b/ccan/compiler/_info index ea4fe702..12cb2475 100644 --- a/ccan/compiler/_info +++ b/ccan/compiler/_info @@ -1,35 +1,37 @@ +#include "config.h" #include #include -#include "config.h" /** * compiler - macros for common compiler extensions * * Abstracts away some compiler hints. Currently these include: - * - UNLIKELY_FUNCTION_ATTRIBUTE + * - COLD * For functions not called in fast paths (aka. cold functions) - * - PRINTF_ATTRIBUTE + * - PRINTF_FMT * For functions which take printf-style parameters. - * - IDEMPOTENT_ATTRIBUTE + * - CONST_FUNCTION * For functions which return the same value for same parameters. - * - NEEDED_ATTRIBUTE + * - NEEDED * For functions and variables which must be emitted even if unused. - * - UNNEEDED_ATTRIBUTE + * - UNNEEDED * For functions and variables which need not be emitted if unused. - * - IS_COMPILE_CONSTANT + * - UNUSED + * For parameters which are not used. + * - IS_COMPILE_CONSTANT() * For using different tradeoffs for compiletime vs runtime evaluation. * - * Licence: LGPL (3 or any later version) + * License: CC0 (Public domain) * Author: Rusty Russell * * Example: - * #include + * #include * #include * #include * * // Example of a (slow-path) logging function. * static int log_threshold = 2; - * static void UNLIKELY_FUNCTION_ATTRIBUTE PRINTF_ATTRIBUTE(2,3) + * static void COLD PRINTF_FMT(2,3) * logger(int level, const char *fmt, ...) * { * va_list ap; @@ -39,7 +41,7 @@ * va_end(ap); * } * - * int main(int argc, char *argv[]) + * int main(int argc, char *argv[] UNNEEDED) * { * if (argc != 1) { * logger(3, "Don't want %i arguments!\n", argc-1);