summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2020-02-25 17:26:07 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2020-02-25 17:26:07 +0000
commit38b6349d5f444bb8f51fa927c3dce53cf422cb09 (patch)
tree58ca0cd725154c581a3fa30e48b8d641cb5fa1d8
parentf35d0428004edf06ea7f5bac1d610fa668ad6767 (diff)
downloadmpfr-38b6349d5f444bb8f51fa927c3dce53cf422cb09.tar.gz
[src/mpfr.h] Use the underscore version of the attribute names.
[doc/README.dev] Added information on this subject. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@13723 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r--doc/README.dev7
-rw-r--r--src/mpfr.h6
2 files changed, 10 insertions, 3 deletions
diff --git a/doc/README.dev b/doc/README.dev
index d180428cd..1ee7ee641 100644
--- a/doc/README.dev
+++ b/doc/README.dev
@@ -681,6 +681,13 @@ user-defined string literal in C++11:
https://en.cppreference.com/w/cpp/language/user_literal
https://stackoverflow.com/a/6402166/3782797
+In at least mpfr.h, use the underscore version of the attribute names
+(e.g. "__sentinel__" instead of "sentinel"), otherwise user code could
+fail to compile with GCC when it defines macros such as "sentinel"
+(before the #include's or via the -D command-line option). See
+
+ https://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html
+
=====================================================================
Setting errno is safe to signal some error information (as in the
diff --git a/src/mpfr.h b/src/mpfr.h
index a26a59640..c434a6526 100644
--- a/src/mpfr.h
+++ b/src/mpfr.h
@@ -272,7 +272,7 @@ typedef enum {
#if defined (__GNUC__)
# if __GNUC__ >= 4
# undef __MPFR_SENTINEL_ATTR
-# define __MPFR_SENTINEL_ATTR __attribute__ ((sentinel))
+# define __MPFR_SENTINEL_ATTR __attribute__ ((__sentinel__))
# endif
#endif
@@ -331,7 +331,7 @@ typedef enum {
*/
#if defined(__GNUC__) && \
(__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
-# define MPFR_DEPRECATED __attribute__ ((deprecated))
+# define MPFR_DEPRECATED __attribute__ ((__deprecated__))
#elif defined(_MSC_VER) && _MSC_VER >= 1300
# define MPFR_DEPRECATED __declspec(deprecated)
#else
@@ -345,7 +345,7 @@ typedef enum {
#if defined(__GNUC__) && \
(__GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 9))
-# define MPFR_RETURNS_NONNULL __attribute__ ((returns_nonnull))
+# define MPFR_RETURNS_NONNULL __attribute__ ((__returns_nonnull__))
#else
# define MPFR_RETURNS_NONNULL
#endif