unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: master 1069364 2/2: Simplify by using attribute.h macros
       [not found] ` <20200503221015.4C8AF20B5B@vcs0.savannah.gnu.org>
@ 2020-05-05  6:57   ` Andreas Schwab
  2020-05-05  7:53     ` Paul Eggert
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Schwab @ 2020-05-05  6:57 UTC (permalink / raw)
  To: emacs-devel; +Cc: Paul Eggert

This is broken:

../src/conf_post.h:297:21: error: missing binary operator before token "("
 #if __has_attribute (no_sanitize_address)
                     ^
../src/conf_post.h:300:23: error: missing binary operator before token "("
 #elif __has_attribute (no_address_safety_analysis)
                       ^
../src/conf_post.h:309:21: error: missing binary operator before token "("
 #if __has_attribute (no_sanitize_undefined)
                     ^
../src/conf_post.h:311:23: error: missing binary operator before token "("
 #elif __has_attribute (no_sanitize)

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: master 1069364 2/2: Simplify by using attribute.h macros
  2020-05-05  6:57   ` master 1069364 2/2: Simplify by using attribute.h macros Andreas Schwab
@ 2020-05-05  7:53     ` Paul Eggert
  2020-05-05 17:11       ` Glenn Morris
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Eggert @ 2020-05-05  7:53 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 391 bytes --]

On 5/4/20 11:57 PM, Andreas Schwab wrote:

> ../src/conf_post.h:297:21: error: missing binary operator before token "("
>  #if __has_attribute (no_sanitize_address)

Thanks for mentioning that, as I didn't see it with either gcc or clang in my
environment. I installed the attached patch to fix the obvious typos nearby. I
hope this fixes the problem; if not please advise how to reproduce.

[-- Attachment #2: 0001-Fix-typos-in-recent-attribute.h-simplification.patch --]
[-- Type: text/x-patch, Size: 2292 bytes --]

From ec44eeef033cddfb0df8fba8bcf8a6a1777b7102 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Tue, 5 May 2020 00:48:48 -0700
Subject: [PATCH] Fix typos in recent attribute.h simplification

Problem reported by Andreas Schwab in:
https://lists.gnu.org/r/emacs-devel/2020-05/msg00650.html
* src/conf_post.h (HAS_ATTR_no_sanitize): Define to false in case
cpp is picky, fixing a longstanding glitch here.
(ATTRIBUTE_NO_SANITIZE_ADDRESS, ATTRIBUTE_NO_SANITIZE_UNDEFINED):
Use HAS_ATTRIBUTE, not __has_attribute.
---
 src/conf_post.h | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/conf_post.h b/src/conf_post.h
index 953b783ebe..1ef4ff3342 100644
--- a/src/conf_post.h
+++ b/src/conf_post.h
@@ -77,6 +77,7 @@ Copyright (C) 1988, 1993-1994, 1999-2002, 2004-2020 Free Software
 # define HAS_ATTRIBUTE(a) HAS_ATTR_##a
 # define HAS_ATTR_cleanup GNUC_PREREQ (3, 4, 0)
 # define HAS_ATTR_no_address_safety_analysis false
+# define HAS_ATTR_no_sanitize false
 # define HAS_ATTR_no_sanitize_address GNUC_PREREQ (4, 8, 0)
 # define HAS_ATTR_no_sanitize_undefined GNUC_PREREQ (4, 9, 0)
 #endif
@@ -294,10 +295,10 @@ #define ATTRIBUTE_MALLOC_SIZE(args) ATTRIBUTE_MALLOC ATTRIBUTE_ALLOC_SIZE (args)
 /* Attribute of functions whose code should not have addresses
    sanitized.  */
 
-#if __has_attribute (no_sanitize_address)
+#if HAS_ATTRIBUTE (no_sanitize_address)
 # define ATTRIBUTE_NO_SANITIZE_ADDRESS \
     __attribute__ ((no_sanitize_address)) ADDRESS_SANITIZER_WORKAROUND
-#elif __has_attribute (no_address_safety_analysis)
+#elif HAS_ATTRIBUTE (no_address_safety_analysis)
 # define ATTRIBUTE_NO_SANITIZE_ADDRESS \
     __attribute__ ((no_address_safety_analysis)) ADDRESS_SANITIZER_WORKAROUND
 #else
@@ -306,9 +307,9 @@ #define ATTRIBUTE_MALLOC_SIZE(args) ATTRIBUTE_MALLOC ATTRIBUTE_ALLOC_SIZE (args)
 
 /* Attribute of functions whose undefined behavior should not be sanitized.  */
 
-#if __has_attribute (no_sanitize_undefined)
+#if HAS_ATTRIBUTE (no_sanitize_undefined)
 # define ATTRIBUTE_NO_SANITIZE_UNDEFINED __attribute__ ((no_sanitize_undefined))
-#elif __has_attribute (no_sanitize)
+#elif HAS_ATTRIBUTE (no_sanitize)
 # define ATTRIBUTE_NO_SANITIZE_UNDEFINED \
     __attribute__ ((no_sanitize ("undefined")))
 #else
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: master 1069364 2/2: Simplify by using attribute.h macros
  2020-05-05  7:53     ` Paul Eggert
@ 2020-05-05 17:11       ` Glenn Morris
  2020-05-06  0:23         ` Paul Eggert
  0 siblings, 1 reply; 4+ messages in thread
From: Glenn Morris @ 2020-05-05 17:11 UTC (permalink / raw)
  To: Paul Eggert; +Cc: Andreas Schwab, emacs-devel


Hydra coverage builds have failed to compile since this change, and
continue to fail as of daab2d3. Most recently:

https://hydra.nixos.org/build/118225504

emacs-module.c: At top level:
emacs-module.c:252:3: error: #error "__attribute__ ((cleanup)) not
supported by this compiler; try GCC"
  #error "__attribute__ ((cleanup)) not supported by this compiler; try GCC"
   ^



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: master 1069364 2/2: Simplify by using attribute.h macros
  2020-05-05 17:11       ` Glenn Morris
@ 2020-05-06  0:23         ` Paul Eggert
  0 siblings, 0 replies; 4+ messages in thread
From: Paul Eggert @ 2020-05-06  0:23 UTC (permalink / raw)
  To: Glenn Morris; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 270 bytes --]

On 5/5/20 10:11 AM, Glenn Morris wrote:

> emacs-module.c:252:3: error: #error "__attribute__ ((cleanup)) not
> supported by this compiler; try GCC"
>   #error "__attribute__ ((cleanup)) not supported by this compiler; try GCC"
>    ^

Thanks, I installed the attached.

[-- Attachment #2: 0001-Don-t-assume-__has_attribute-in-emacs-module.c.patch --]
[-- Type: text/x-patch, Size: 1119 bytes --]

From 4658a44f1464c274f377f593717b1a40bbfd47e5 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Tue, 5 May 2020 17:16:49 -0700
Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20assume=20=5F=5Fhas=5Fattribute?=
 =?UTF-8?q?=20in=20emacs-module.c?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Problem reported by Glenn Morris in:
https://lists.gnu.org/r/emacs-devel/2020-05/msg00724.html
* src/emacs-module.c: Use HAS_ATTRIBUTE instead of assuming
the compiler supports __has_attribute.
---
 src/emacs-module.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/emacs-module.c b/src/emacs-module.c
index e43e4907d2..3d1827c7da 100644
--- a/src/emacs-module.c
+++ b/src/emacs-module.c
@@ -248,7 +248,7 @@ module_decode_utf_8 (const char *str, ptrdiff_t len)
    of `internal_condition_case' etc., and to avoid worrying about
    passing information to the handler functions.  */
 
-#if !__has_attribute (cleanup)
+#if !HAS_ATTRIBUTE (cleanup)
  #error "__attribute__ ((cleanup)) not supported by this compiler; try GCC"
 #endif
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-05-06  0:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20200503221011.6736.42592@vcs0.savannah.gnu.org>
     [not found] ` <20200503221015.4C8AF20B5B@vcs0.savannah.gnu.org>
2020-05-05  6:57   ` master 1069364 2/2: Simplify by using attribute.h macros Andreas Schwab
2020-05-05  7:53     ` Paul Eggert
2020-05-05 17:11       ` Glenn Morris
2020-05-06  0:23         ` Paul Eggert

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).