Subject: Re: bug#27346: module tests fail to compile with gcc 4.8.5

From: Glenn Morris <[email-masked]>
Date: Mon, 12 Jun 2017 16:28:55 -0400

Eli Zaretskii wrote:

> I think the "if defined __has_attribute &&" part is not needed, since
> conf_post.h defines it fr compilers that lack it.  Can you try that?

emacs-module.h does not include config.h, and I don't know if it should.
(I see no src/*.h file includes config.h, except cygw32.h.
Should it? It could easily be changed not to.)

If not, then I guess something like the following is needed:

--- a/src/emacs-module.h
+++ b/src/emacs-module.h
@@ -35,9 +35,12 @@
 # define EMACS_NOEXCEPT
 #endif
 
-#if defined __has_attribute && __has_attribute(__nonnull__)
+#ifdef __has_attribute
+#if __has_attribute(__nonnull__)
 # define EMACS_ATTRIBUTE_NONNULL(...)
 __attribute__((__nonnull__(__VA_ARGS__)))
-#else
+#endif
+#endif
+#ifndef EMACS_ATTRIBUTE_NONNULL
 # define EMACS_ATTRIBUTE_NONNULL(...)
 #endif

(Even with this change or your suggestion, I then get "Module initialization
failed" when running the tests, but that's probably a different issue.)