Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F145980565
D45836.id140473.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D45836.id140473.diff
View Options
diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h
--- a/sys/sys/cdefs.h
+++ b/sys/sys/cdefs.h
@@ -349,9 +349,7 @@
/*
* Compiler-dependent macros to declare that functions take printf-like
- * or scanf-like arguments. They are null except for versions of gcc
- * that are known to support the features properly (old versions of gcc-2
- * didn't permit keeping the keywords out of the application namespace).
+ * or scanf-like arguments.
*/
#define __printflike(fmtarg, firstvararg) \
__attribute__((__format__ (__printf__, fmtarg, firstvararg)))
@@ -363,8 +361,20 @@
#define __strftimelike(fmtarg, firstvararg) \
__attribute__((__format__ (__strftime__, fmtarg, firstvararg)))
+/*
+ * Like __printflike, but allows fmtarg to be NULL. All supported FreeBSD
+ * versions of gcc have this feature, but stock versions of gcc, including
+ * lang/gcc, do not. Clang has it for all supported versions. While stock
+ * versions of gcc ignore printf0 in system headers, we define it away so
+ * -Wsystem-headers is more useful for those versions. tcc and pcc mirror gcc's
+ * behavior.
+ */
+#if defined(__clang__) || (defined(__GNUC__) && defined(__FreeBSD_cc_version))
#define __printf0like(fmtarg, firstvararg) \
__attribute__((__format__ (__printf0__, fmtarg, firstvararg)))
+#else
+#define __printf0like(fmtarg, firstvararg)
+#endif
#define __strong_reference(sym,aliassym) \
extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym)))
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Feb 27, 5:45 PM (5 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29037621
Default Alt Text
D45836.id140473.diff (1 KB)
Attached To
Mode
D45836: cdefs.h: Add back fallback define for __printf0like
Attached
Detach File
Event Timeline
Log In to Comment