r13019: Again protect us against format string mismatches, with the new split
authorAndrew Bartlett <abartlet@samba.org>
Wed, 18 Jan 2006 21:52:19 +0000 (21:52 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:51:17 +0000 (13:51 -0500)
out proto headers.

The reason this is done in this way is that the attribute must be on
the prototype, not the actual function defintion.  Hence the macros
which expand to nothing in the C file, but expand to an __attribute__
in the prototype header.

Andrew Bartlett

source/include/includes.h
source/script/mkproto.pl

index 29c868ff39f446c25daa5d39ef165dc79138e55e..ed8de0607d5cc9844b2b79e38b8fbd904bd09aa4 100644 (file)
@@ -112,12 +112,13 @@ struct ipv4_addr {
 #include "auth/credentials/credentials.h"
 #include "libcli/nbt/libnbt.h"
 
-/***** automatically generated prototypes *****/
-#include "include/proto.h"
-#include "basic.h"
 #undef _PRINTF_ATTRIBUTE
 #define _PRINTF_ATTRIBUTE(a1, a2)
 
+/***** automatically generated prototypes *****/
+#include "basic.h"
+#include "include/proto.h"
+
 /* String routines */
 
 #include "safe_string.h"
index 2332cb06abb6a0edf0dafc0a60278d6265ab26b7..9939fe0bf7cfdd1bf3c749bf314b5dca908dd78d 100755 (executable)
@@ -72,13 +72,17 @@ sub print_header($$)
        my ($file, $header_name) = @_;
        print $file "#ifndef $header_name\n";
        print $file "#define $header_name\n\n";
+       print $file "#undef _PRINTF_ATTRIBUTE\n";
+       print $file "#define _PRINTF_ATTRIBUTE(a1, a2) PRINTF_ATTRIBUTE(a1, a2)\n";
        print $file "/* This file was automatically generated by mkproto.pl. DO NOT EDIT */\n\n";
 }
 
 sub print_footer($$) 
 {
        my ($file, $header_name) = @_;
-       printf $file "\n#endif /*  %s  */\n", $header_name;
+       print $file "#undef _PRINTF_ATTRIBUTE\n";
+       print $file "#define _PRINTF_ATTRIBUTE(a1, a2)\n";
+       print $file "\n#endif /* $header_name */\n\n";
 }
 
 sub handle_loadparm($$)