[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master e59f697: Improve nonnull checking with GCC in emacs-module
From: |
Paul Eggert |
Subject: |
master e59f697: Improve nonnull checking with GCC in emacs-module |
Date: |
Sat, 9 May 2020 12:11:58 -0400 (EDT) |
branch: master
commit e59f697cd589e2b68bccb752787ad4a8c9da375d
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>
Improve nonnull checking with GCC in emacs-module
* src/emacs-module.h.in (EMACS_ATTRIBUTE_NONNULL):
Also do the nonnull check with GCC. (The old code did the
check with Clang but not with GCC.)
---
src/emacs-module.h.in | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/src/emacs-module.h.in b/src/emacs-module.h.in
index cd75c09..6a39d50 100644
--- a/src/emacs-module.h.in
+++ b/src/emacs-module.h.in
@@ -48,10 +48,14 @@ information how to write modules and use this header file.
# define EMACS_NOEXCEPT_TYPEDEF
#endif
-#ifdef __has_attribute
-#if __has_attribute(__nonnull__)
-# define EMACS_ATTRIBUTE_NONNULL(...) __attribute__((__nonnull__(__VA_ARGS__)))
-#endif
+#if 3 < __GNUC__ + (3 <= __GNUC_MINOR__)
+# define EMACS_ATTRIBUTE_NONNULL(...) \
+ __attribute__ ((__nonnull__ (__VA_ARGS__)))
+#elif defined __has_attribute
+# if __has_attribute (__nonnull__)
+# define EMACS_ATTRIBUTE_NONNULL(...) \
+ __attribute__ ((__nonnull__ (__VA_ARGS__)))
+# endif
#endif
#ifndef EMACS_ATTRIBUTE_NONNULL
# define EMACS_ATTRIBUTE_NONNULL(...)
@@ -81,7 +85,7 @@ struct emacs_runtime
/* Return an environment pointer. */
emacs_env *(*get_environment) (struct emacs_runtime *runtime)
- EMACS_ATTRIBUTE_NONNULL(1);
+ EMACS_ATTRIBUTE_NONNULL (1);
};
/* Type aliases for function pointer types used in the module API.
@@ -166,7 +170,7 @@ struct emacs_env_28
/* Every module should define a function as follows. */
extern int emacs_module_init (struct emacs_runtime *runtime)
EMACS_NOEXCEPT
- EMACS_ATTRIBUTE_NONNULL(1);
+ EMACS_ATTRIBUTE_NONNULL (1);
#ifdef __cplusplus
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master e59f697: Improve nonnull checking with GCC in emacs-module,
Paul Eggert <=