mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 03:09:34 +03:00
Fix compiling on FreeBSD + gcc - don't assume illmnos bits
This looks like it was once from the illumnos compat code. FreeBSD doesn't have cmn_err as a compiler format attribute, so it definitely errors out. It doesn't show up on LLVM because it doesn't trigger at all. Add in the format flags but keep them behind #if 0 for now; there are too many format issues that trigger when one does format checking in the shared code. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Signed-off-by: adrian chadd <adrian@freebsd.org> Closes #11068 Closes #11069
This commit is contained in:
parent
79a357c2a1
commit
3fcd737478
@ -48,6 +48,7 @@ extern "C" {
|
|||||||
|
|
||||||
#if defined(__ATTRIBUTE_IMPLEMENTED) || defined(__GNUC__)
|
#if defined(__ATTRIBUTE_IMPLEMENTED) || defined(__GNUC__)
|
||||||
|
|
||||||
|
#if 0
|
||||||
/*
|
/*
|
||||||
* analogous to lint's PRINTFLIKEn
|
* analogous to lint's PRINTFLIKEn
|
||||||
*/
|
*/
|
||||||
@ -56,20 +57,28 @@ extern "C" {
|
|||||||
#define __sun_attr___VPRINTFLIKE__(__n) \
|
#define __sun_attr___VPRINTFLIKE__(__n) \
|
||||||
__attribute__((__format__(printf, __n, 0)))
|
__attribute__((__format__(printf, __n, 0)))
|
||||||
|
|
||||||
/*
|
|
||||||
* Handle the kernel printf routines that can take '%b' too
|
|
||||||
*/
|
|
||||||
#if __GNUC_VERSION < 30402
|
|
||||||
/*
|
|
||||||
* XX64 at least this doesn't work correctly yet with 3.4.1 anyway!
|
|
||||||
*/
|
|
||||||
#define __sun_attr___KPRINTFLIKE__ __sun_attr___PRINTFLIKE__
|
#define __sun_attr___KPRINTFLIKE__ __sun_attr___PRINTFLIKE__
|
||||||
#define __sun_attr___KVPRINTFLIKE__ __sun_attr___VPRINTFLIKE__
|
#define __sun_attr___KVPRINTFLIKE__ __sun_attr___VPRINTFLIKE__
|
||||||
#else
|
#else
|
||||||
#define __sun_attr___KPRINTFLIKE__(__n) \
|
/*
|
||||||
__attribute__((__format__(cmn_err, __n, (__n)+1)))
|
* Currently the openzfs codebase has a lot of formatting errors
|
||||||
#define __sun_attr___KVPRINTFLIKE__(__n) \
|
* which are not picked up in the linux build because they're not
|
||||||
__attribute__((__format__(cmn_err, __n, 0)))
|
* doing formatting checks. LLVM's kprintf implementation doesn't
|
||||||
|
* actually do format checks!
|
||||||
|
*
|
||||||
|
* For FreeBSD these break under gcc! LLVM shim'ed cmn_err as a
|
||||||
|
* format attribute but also didn't check anything. If one
|
||||||
|
* replaces it with the above, all of the format issues
|
||||||
|
* in the codebase show up.
|
||||||
|
*
|
||||||
|
* Once those format string issues are addressed, the above
|
||||||
|
* should be flipped on once again.
|
||||||
|
*/
|
||||||
|
#define __sun_attr___PRINTFLIKE__(__n)
|
||||||
|
#define __sun_attr___VPRINTFLIKE__(__n)
|
||||||
|
#define __sun_attr___KPRINTFLIKE__(__n)
|
||||||
|
#define __sun_attr___KVPRINTFLIKE__(__n)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -77,7 +86,6 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
#define __sun_attr___noreturn__ __attribute__((__noreturn__))
|
#define __sun_attr___noreturn__ __attribute__((__noreturn__))
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is an appropriate label for functions that do not
|
* This is an appropriate label for functions that do not
|
||||||
* modify their arguments, e.g. strlen()
|
* modify their arguments, e.g. strlen()
|
||||||
|
Loading…
Reference in New Issue
Block a user