-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
-std=gnu99 broke build on CentOS 7 #5611
Comments
I was convinced this would make it work (while figuring out why) diff --git a/src/common.h b/src/common.h
index a0b7535..2a37e13 100644
--- a/src/common.h
+++ b/src/common.h
@@ -60,8 +60,6 @@
#else
#define MAYBE_INLINE __inline__
#endif
-#elif __STDC_VERSION__ >= 199901L
-#define MAYBE_INLINE inline
#else
#define MAYBE_INLINE
#endif
But it doesn't make any difference. |
"dynamic_fmt.c:5274: undefined reference to `MD5_body_for_thread'" Non-static function using "inline" doesn't get external linkage unless also declared with "extern" somewhere. I'm not 100% sure but this one compiler may actually do the right thing while all the ones not bailing out break the standard for compatibility reasons. Closes openwall#5611
TIL that the idea of the C99 way of doing this, is you should put the definition of the inline function in the header file: inline void func(...)
{
... actual code ...
} and only a declaration (adding extern inline void func(...); That last thing triggers external linkage. It sounds backwards until you think again: Any file sourcing the header can get the full function for inlining, but if they don't inline it, the extern declaration ensured there's linkage. I never understood this until now. |
FWIW, the Linux kernel appears to do this backwards - their only uses of /*
* Prefer gnu_inline, so that extern inline functions do not emit an
* externally visible function. This makes extern inline behave as per gnu89
* semantics rather than c99. This prevents multiple symbol definition errors
* of extern inline functions at link time.
* A lot of inline functions can cause havoc with function tracing.
*/
#define inline inline __gnu_inline __inline_maybe_unused notrace ... and there I was hoping to use Linux as our example of how to do it right. Well, it may be right for what's needed there, but not for a more portable project such as ours. |
Also, they have |
@magnumripper I think you may partially misunderstand the
|
#5600 broke build (or rather the final linking) on our "well" as follows:
I've tried adding
-std=gnu99
also at link time, but this made no difference.The text was updated successfully, but these errors were encountered: