Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preprocessor error in gcc 5.2 #13

Open
shevek opened this issue Jan 11, 2016 · 2 comments
Open

Preprocessor error in gcc 5.2 #13

shevek opened this issue Jan 11, 2016 · 2 comments

Comments

@shevek
Copy link
Owner

shevek commented Jan 11, 2016

I encountered a compile error while compiling libspf2 1.2.10 with gcc 5.2.1 on
Linux. The issue is that it does not like C99-style variadic macros that do not
expand to at least one argument. For example:

spf_dns.c: In function 'SPF_dns_debug_post':
../../src/include/spf_log.h:66:86: error: expected expression before ')' token
#define SPF_debugf(format, ... ) SPF_debugx( FILE, LINE, format, VA_ARGS )

due to:

SPF_debugf(" - Unknown RR type");

The attached patch fixes the problem for gcc and should be fully portable elsewhere.

Dan

libspf2-1.2.10-mga-varargs.patch

Index: libspf2-1.2.10/src/include/spf_log.h
===================================================================
--- libspf2-1.2.10/src/include/spf_log.h
+++ libspf2-1.2.10/src/include/spf_log.h    2015-10-20 23:23:04.579055906 +0200
@@ -60,10 +60,10 @@

 #if defined( __STDC_VERSION__ ) && __STDC_VERSION__ >= 199901L

-#define SPF_errorf(format, ... ) SPF_errorx( __FILE__, __LINE__, format, __VA_ARGS__ )
-#define SPF_warningf(format, ... ) SPF_warningx( __FILE__, __LINE__, format, __VA_ARGS__ )
-#define SPF_infof(format, ... ) SPF_infox( __FILE__, __LINE__, format, __VA_ARGS__ )
-#define SPF_debugf(format, ... ) SPF_debugx( __FILE__, __LINE__, format, __VA_ARGS__ )
+#define SPF_errorf(...) SPF_errorx( __FILE__, __LINE__, __VA_ARGS__ )
+#define SPF_warningf(...) SPF_warningx( __FILE__, __LINE__, __VA_ARGS__ )
+#define SPF_infof(...) SPF_infox( __FILE__, __LINE__, __VA_ARGS__ )
+#define SPF_debugf(...) SPF_debugx( __FILE__, __LINE__, __VA_ARGS__ )

 #elif defined( __GNUC__ )

@puleglot
Copy link

Building with gcc-5 was fixed by 5852828, but it seems gcc-specific.

@herriett
Copy link

I can confirm this bug for gentoo gcc-5.4.0 with libspf2-1.2.0.

Error message is identic to sheveks report and his patch works. So this bug is not fixed as of August 12, 2017...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants