From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#22385: 24.5; Build failure with modules on OpenBSD Date: Sun, 17 Jan 2016 14:30:46 -0800 Organization: UCLA Computer Science Department Message-ID: <569C1616.5030603@cs.ucla.edu> References: <87h9idmncj.fsf@netbook.my.domain> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------080000060408070607050900" X-Trace: ger.gmane.org 1453069886 15670 80.91.229.3 (17 Jan 2016 22:31:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 17 Jan 2016 22:31:26 +0000 (UTC) Cc: Gabriele Svelto , 22385-done@debbugs.gnu.org To: Joakim Jalap Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jan 17 23:31:15 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aKvqs-0001BD-0i for geb-bug-gnu-emacs@m.gmane.org; Sun, 17 Jan 2016 23:31:14 +0100 Original-Received: from localhost ([::1]:56122 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aKvqo-0003EI-BQ for geb-bug-gnu-emacs@m.gmane.org; Sun, 17 Jan 2016 17:31:10 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45791) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aKvqj-0003Du-Ak for bug-gnu-emacs@gnu.org; Sun, 17 Jan 2016 17:31:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aKvqf-0006Wz-W3 for bug-gnu-emacs@gnu.org; Sun, 17 Jan 2016 17:31:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:35690) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aKvqf-0006Ws-RA for bug-gnu-emacs@gnu.org; Sun, 17 Jan 2016 17:31:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aKvqf-0002B5-NX for bug-gnu-emacs@gnu.org; Sun, 17 Jan 2016 17:31:01 -0500 In-Reply-To: <87h9idmncj.fsf@netbook.my.domain> Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Sun, 17 Jan 2016 22:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 22385 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Mail-Followup-To: 22385@debbugs.gnu.org, eggert@cs.ucla.edu, joakim.jalap@fastmail.com Original-Received: via spool by 22385-done@debbugs.gnu.org id=D22385.14530698578108 (code D ref 22385); Sun, 17 Jan 2016 22:31:01 +0000 Original-Received: (at 22385-done) by debbugs.gnu.org; 17 Jan 2016 22:30:57 +0000 Original-Received: from localhost ([127.0.0.1]:52143 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aKvqb-000266-1w for submit@debbugs.gnu.org; Sun, 17 Jan 2016 17:30:57 -0500 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:53082) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aKvqZ-0001xH-3t for 22385-done@debbugs.gnu.org; Sun, 17 Jan 2016 17:30:56 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 2D9B6160017; Sun, 17 Jan 2016 14:30:49 -0800 (PST) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id eziaMDitWzD0; Sun, 17 Jan 2016 14:30:46 -0800 (PST) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id CB14F160544; Sun, 17 Jan 2016 14:30:46 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 25YJBW4ImjN4; Sun, 17 Jan 2016 14:30:46 -0800 (PST) Original-Received: from [192.168.1.9] (pool-100-32-155-148.lsanca.fios.verizon.net [100.32.155.148]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id A1F12160017; Sun, 17 Jan 2016 14:30:46 -0800 (PST) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:111689 Archived-At: This is a multi-part message in MIME format. --------------080000060408070607050900 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Thanks for reporting the problem. The OpenBSD compiler warnings about strcpy etc. are false alarms, and these false alarms confuse the Emacs build procedure and therefore introduce bugs into the Emacs module code. We're lucky that a run-time assertion caught this. I installed the attached patch into the emacs-25 branch. It removes the offending test in 'configure', and so should fix the bug so I am boldly marking it as done. Please give the fix a try; if it doesn't work I can unmark the bug. Is there some way to tell the OpenBSD C compiler to not chatter about uses of strcpy, strcat, and sprintf? We don't want to use the OpenBSD-suggested replacements in Emacs, as that would be more likely to introduce bugs than to fix them. If we can suggest (or get 'configure' to use) a build-time option to suppress the false alarms that would save everybody some work and would help make Emacs more reliable. Although the OpenBSD porting problem with AX_GCC_VAR_ATTRIBUTE no longer affects Emacs, it might affect other programs that use that macro, so I'll CC: this to the macro's author Gabriele Svelto. Gabriele, the bug report is here: http://bugs.gnu.org/22385 --------------080000060408070607050900 Content-Type: text/x-diff; name="0001-Port-cleanup-attribute-to-OpenBSD.patch" Content-Disposition: attachment; filename="0001-Port-cleanup-attribute-to-OpenBSD.patch" Content-Transfer-Encoding: quoted-printable >From 1addf499c8318ecf2b00e1c60dfa56e67bc1689e Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 17 Jan 2016 14:10:26 -0800 Subject: [PATCH] Port cleanup attribute to OpenBSD MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit The OpenBSD C compiler issues false alarms about strcpy, strcat, and sprintf, and this messes up 'configure' when it tests for the cleanup attribute. Work around the problem by using __has_attribute directly. Problem reported by Joakim Jalap (Bug#22385). * configure.ac: Don=E2=80=99t use AX_GCC_VAR_ATTRIBUTE. * m4/ax_gcc_var_attribute.m4: Remove. * src/conf_post.h (__has_attribute): Provide a substitute, for non-GCC or older GCC compilers. All uses changed to assume the substitute. Check for the cleanup attribute. * src/emacs-module.c (module_has_cleanup): Just use __has_attribute. --- configure.ac | 1 - m4/ax_gcc_var_attribute.m4 | 141 ---------------------------------------= ------ src/conf_post.h | 28 +++++---- src/emacs-module.c | 3 +- 4 files changed, 18 insertions(+), 155 deletions(-) delete mode 100644 m4/ax_gcc_var_attribute.m4 diff --git a/configure.ac b/configure.ac index 8c01aba..3aeba22 100644 --- a/configure.ac +++ b/configure.ac @@ -3327,7 +3327,6 @@ if test "${HAVE_MODULES}" =3D yes; then fi AC_SUBST(MODULES_OBJ) AC_SUBST(LIBMODULES) -AX_GCC_VAR_ATTRIBUTE(cleanup) AC_CHECK_FUNCS(dladdr) =20 ### Use -lpng if available, unless '--with-png=3Dno'. diff --git a/m4/ax_gcc_var_attribute.m4 b/m4/ax_gcc_var_attribute.m4 deleted file mode 100644 index d12fce8..0000000 --- a/m4/ax_gcc_var_attribute.m4 +++ /dev/null @@ -1,141 +0,0 @@ -# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D -# http://www.gnu.org/software/autoconf-archive/ax_gcc_var_attribute.ht= ml -# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D -# -# SYNOPSIS -# -# AX_GCC_VAR_ATTRIBUTE(ATTRIBUTE) -# -# DESCRIPTION -# -# This macro checks if the compiler supports one of GCC's variable -# attributes; many other compilers also provide variable attributes wi= th -# the same syntax. Compiler warnings are used to detect supported -# attributes as unsupported ones are ignored by default so quieting -# warnings when using this macro will yield false positives. -# -# The ATTRIBUTE parameter holds the name of the attribute to be checke= d. -# -# If ATTRIBUTE is supported define HAVE_VAR_ATTRIBUTE_. -# -# The macro caches its result in the ax_cv_have_var_attribute_ -# variable. -# -# The macro currently supports the following variable attributes: -# -# aligned -# cleanup -# common -# nocommon -# deprecated -# mode -# packed -# tls_model -# unused -# used -# vector_size -# weak -# dllimport -# dllexport -# init_priority -# -# Unsupported variable attributes will be tested against a global inte= ger -# variable and without any arguments given to the attribute itself; th= e -# result of this check might be wrong or meaningless so use with care. -# -# LICENSE -# -# Copyright (c) 2013 Gabriele Svelto -# -# Copying and distribution of this file, with or without modification,= are -# permitted in any medium without royalty provided the copyright notic= e -# and this notice are preserved. This file is offered as-is, without = any -# warranty. - -#serial 3 - -AC_DEFUN([AX_GCC_VAR_ATTRIBUTE], [ - AS_VAR_PUSHDEF([ac_var], [ax_cv_have_var_attribute_$1]) - - AC_CACHE_CHECK([for __attribute__(($1))], [ac_var], [ - AC_LINK_IFELSE([AC_LANG_PROGRAM([ - m4_case([$1], - [aligned], [ - int foo __attribute__(($1(32))); - ], - [cleanup], [ - int bar(int *t) { return *t; }; - ], - [common], [ - int foo __attribute__(($1)); - ], - [nocommon], [ - int foo __attribute__(($1)); - ], - [deprecated], [ - int foo __attribute__(($1)) =3D 0; - ], - [mode], [ - long foo __attribute__(($1(word))); - ], - [packed], [ - struct bar { - int baz __attribute__(($1)); - }; - ], - [tls_model], [ - __thread int bar1 __attribute__(($1("global-dynamic"= ))); - __thread int bar2 __attribute__(($1("local-dynamic")= )); - __thread int bar3 __attribute__(($1("initial-exec"))= ); - __thread int bar4 __attribute__(($1("local-exec"))); - ], - [unused], [ - int foo __attribute__(($1)); - ], - [used], [ - int foo __attribute__(($1)); - ], - [vector_size], [ - int foo __attribute__(($1(16))); - ], - [weak], [ - int foo __attribute__(($1)); - ], - [dllimport], [ - int foo __attribute__(($1)); - ], - [dllexport], [ - int foo __attribute__(($1)); - ], - [init_priority], [ - struct bar { bar() {} ~bar() {} }; - bar b __attribute__(($1(65535/2))); - ], - [ - m4_warn([syntax], [Unsupported attribute $1, the test m= ay fail]) - int foo __attribute__(($1)); - ] - )], [ - m4_case([$1], - [cleanup], [ - int foo __attribute__(($1(bar))) =3D 0; - foo =3D foo + 1; - ], - [] - )]) - ], - dnl GCC doesn't exit with an error if an unknown attribute i= s - dnl provided but only outputs a warning, so accept the attri= bute - dnl only if no warning were issued. - [AS_IF([test -s conftest.err], - [AS_VAR_SET([ac_var], [no])], - [AS_VAR_SET([ac_var], [yes])])], - [AS_VAR_SET([ac_var], [no])]) - ]) - - AS_IF([test yes =3D AS_VAR_GET([ac_var])], - [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_VAR_ATTRIBUTE_$1), 1, - [Define to 1 if the system has the `$1' variable attribute])= ], []) - - AS_VAR_POPDEF([ac_var]) -]) diff --git a/src/conf_post.h b/src/conf_post.h index 98ff12e..5c332a0 100644 --- a/src/conf_post.h +++ b/src/conf_post.h @@ -51,10 +51,21 @@ typedef bool bool_bf; #endif #endif =20 -/* When not using Clang, assume its attributes and features are absent. = */ +/* Simulate __has_attribute on compilers that lack it. It is used only + on arguments like alloc_size that are handled in this simulation. */ #ifndef __has_attribute -# define __has_attribute(a) false -#endif +# define __has_attribute(a) __has_attribute_##a +# define __has_attribute_alloc_size (4 < __GNUC__ + (3 <=3D __GNUC_MINOR= __)) +# define __has_attribute_cleanup (3 < __GNUC__ + (4 <=3D __GNUC_MINOR__)= ) +# define __has_attribute_externally_visible \ + (4 < __GNUC__ + (1 <=3D __GNUC_MINOR__)) +# define __has_attribute_no_address_safety_analysis false +# define __has_attribute_no_sanitize_address \ + (4 < __GNUC__ + (8 <=3D __GNUC_MINOR__)) +#endif + +/* Simulate __has_feature on compilers that lack it. It is used only + to define ADDRESS_SANITIZER below. */ #ifndef __has_feature # define __has_feature(a) false #endif @@ -222,9 +233,7 @@ extern int emacs_setenv_TZ (char const *); #define NO_INLINE #endif =20 -#if (__clang__ \ - ? __has_attribute (externally_visible) \ - : (__GNUC__ > 4 || (__GNUC__ =3D=3D 4 && __GNUC_MINOR__ >=3D 1))) +#if __has_attribute (externally_visible) #define EXTERNALLY_VISIBLE __attribute__((externally_visible)) #else #define EXTERNALLY_VISIBLE @@ -253,9 +262,7 @@ extern int emacs_setenv_TZ (char const *); # define ATTRIBUTE_MALLOC #endif =20 -#if (__clang__ \ - ? __has_attribute (alloc_size) \ - : 4 < __GNUC__ + (3 <=3D __GNUC_MINOR__)) +#if __has_attribute (alloc_size) # define ATTRIBUTE_ALLOC_SIZE(args) __attribute__ ((__alloc_size__ args)= ) #else # define ATTRIBUTE_ALLOC_SIZE(args) @@ -278,8 +285,7 @@ extern int emacs_setenv_TZ (char const *); /* Attribute of functions whose code should not have addresses sanitized. */ =20 -#if (__has_attribute (no_sanitize_address) \ - || 4 < __GNUC__ + (8 <=3D __GNUC_MINOR__)) +#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) diff --git a/src/emacs-module.c b/src/emacs-module.c index b5e044e..79a077b 100644 --- a/src/emacs-module.c +++ b/src/emacs-module.c @@ -35,8 +35,7 @@ along with GNU Emacs. If not, see . */ =0C /* Feature tests. */ =20 -/* True if __attribute__ ((cleanup (...))) works, false otherwise. */ -#ifdef HAVE_VAR_ATTRIBUTE_CLEANUP +#if __has_attribute (cleanup) enum { module_has_cleanup =3D true }; #else enum { module_has_cleanup =3D false }; --=20 2.5.0 --------------080000060408070607050900--