Date: Tue, 16 Oct 2001 15:58:36 -0700 (PDT) From: John Baldwin <jhb@FreeBSD.org> To: "Grover, Andrew" <andrew.grover@intel.com> Cc: ia64@FreeBSD.ORG, Marcel Moolenaar <marcel@xcllnt.net>, Mike Smith <msmith@FreeBSD.ORG>, Peter Wemm <peter@wemm.org> Subject: RE: Faulty ACPI debug code [was: Re: Booting a dual ...] Message-ID: <XFMail.011016155836.jhb@FreeBSD.org> In-Reply-To: <59885C5E3098D511AD690002A5072D3C42D66E@orsmsx111.jf.intel.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 16-Oct-01 Grover, Andrew wrote: > Hi Peter, > > Thanks for the problem reports. Our code can't use GCC extensions and > maintain ANSI C conformance, but it sure looks like using them briefly and > cleaning up the code would be a good thing to do...;-) One thing you can do is use a macro similar to the way FreeBSD does: /* * 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). */ #if __GNUC__ < 2 || __GNUC__ == 2 && __GNUC_MINOR__ < 7 #define __printflike(fmtarg, firstvararg) #define __scanflike(fmtarg, firstvararg) #else #define __printflike(fmtarg, firstvararg) \ __attribute__((__format__ (__printf__, fmtarg, firstvararg))) #define __scanflike(fmtarg, firstvararg) \ __attribute__((__format__ (__scanf__, fmtarg, firstvararg))) #endif You can then use '__printflike(4, 5)' instead of using __attribute__ directly. This gives you all the warnings on newer versions of GCC while still allowing the code to compile on other compilers without problems. -- John Baldwin <jhb@FreeBSD.org> -- http://www.FreeBSD.org/~jhb/ PGP Key: http://www.baldwin.cx/~john/pgpkey.asc "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ia64" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.011016155836.jhb>