From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Re: 27bb4de72b * Port cleanup attribute to Oracle Studio 12.5 Date: Thu, 15 Jun 2017 13:33:23 -0700 Organization: UCLA Computer Science Department Message-ID: <945936bf-42a6-93f8-7b8d-63cdac42c6ee@cs.ucla.edu> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------D10D39D00E9C31D0605C55C6" X-Trace: blaine.gmane.org 1497558828 12744 195.159.176.226 (15 Jun 2017 20:33:48 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 15 Jun 2017 20:33:48 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 To: Philipp Stephani , Emacs developers Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jun 15 22:33:39 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dLbSU-0002n4-Q8 for ged-emacs-devel@m.gmane.org; Thu, 15 Jun 2017 22:33:39 +0200 Original-Received: from localhost ([::1]:55717 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLbSZ-0003ij-Qd for ged-emacs-devel@m.gmane.org; Thu, 15 Jun 2017 16:33:43 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37061) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLbSS-0003hi-2F for emacs-devel@gnu.org; Thu, 15 Jun 2017 16:33:37 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dLbSN-00068D-5i for emacs-devel@gnu.org; Thu, 15 Jun 2017 16:33:36 -0400 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:38892) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dLbSM-00067E-Sh for emacs-devel@gnu.org; Thu, 15 Jun 2017 16:33:31 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 944C01600A6; Thu, 15 Jun 2017 13:33:27 -0700 (PDT) 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 7UFYIOtNuxdc; Thu, 15 Jun 2017 13:33:24 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 9FF381600A7; Thu, 15 Jun 2017 13:33:24 -0700 (PDT) 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 m-EGO92AN4EO; Thu, 15 Jun 2017 13:33:24 -0700 (PDT) Original-Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 4018F1600A6; Thu, 15 Jun 2017 13:33:24 -0700 (PDT) In-Reply-To: Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 131.179.128.68 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:215656 Archived-At: This is a multi-part message in MIME format. --------------D10D39D00E9C31D0605C55C6 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 06/15/2017 12:20 PM, Philipp Stephani wrote: > we might even compile emacs-modules.c as C++ unconditionally. I guess > by now every system that has a C compiler and supports shared > libraries also has a C++ compiler. Although C++ compilers may be available, they (or their libraries) are not necessarily installed properly, and this can be a problem at runtime as well as at compile-time. So it may be better to stick with C if it works. > (i.e. this doesn't even need --enable-gcc-warnings) > Ah, that's key. Although 'configure' suppresses that false alarm if --enable-gcc-warnings is specified, it also needs to suppress it when --enable-gcc-warnings is *not* specified. I installed the attached, which I hope fixes the warnings that were annoying you (assuming we are not using -save-temps, which is a reasonable assumption). --------------D10D39D00E9C31D0605C55C6 Content-Type: text/x-patch; name="0001-Pacify-clang-without-munging-C-source.patch" Content-Disposition: attachment; filename="0001-Pacify-clang-without-munging-C-source.patch" Content-Transfer-Encoding: quoted-printable >From a8ce87fa150b318134aed4a97d1b1a8c2757c805 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 15 Jun 2017 13:29:04 -0700 Subject: [PATCH] Pacify clang without munging C source MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit * configure.ac (WARN_CFLAGS): With Clang, use -Wno-tautological-compare regardless of --enable-gcc-warnings. (WERROR_CFLAGS): Simplify assignments, and guarantee it=E2=80=99s always = set. * lib/strftime.c: Copy from gnulib, reverting Clang-specific change which I hope is no longer needed. * src/emacs.c (main): Revert rlim_t change, as rlim_t is signed on some older non-POSIX hosts. --- configure.ac | 38 +++++++++++++++++++++----------------- lib/strftime.c | 27 +++++++++++---------------- src/emacs.c | 4 ++-- 3 files changed, 34 insertions(+), 35 deletions(-) diff --git a/configure.ac b/configure.ac index 459e314..9069e5b 100644 --- a/configure.ac +++ b/configure.ac @@ -891,6 +891,7 @@ AC_DEFUN [emacs_cv_clang=3Dyes], [emacs_cv_clang=3Dno])]) =20 +WERROR_CFLAGS=3D # When compiling with GCC, prefer -isystem to -I when including system # include files, to avoid generating useless diagnostics for the files. AS_IF([test $gl_gcc_warnings =3D no], @@ -900,7 +901,6 @@ AC_DEFUN [ # Turn off some warnings if supported. gl_WARN_ADD([-Wno-switch]) - gl_WARN_ADD([-Wno-tautological-constant-out-of-range-compare]) gl_WARN_ADD([-Wno-pointer-sign]) gl_WARN_ADD([-Wno-string-plus-int]) gl_WARN_ADD([-Wno-unknown-attributes]) @@ -918,8 +918,7 @@ AC_DEFUN ;; esac AS_IF([test $gl_gcc_warnings =3D yes], - [gl_WARN_ADD([-Werror], [WERROR_CFLAGS])]) - AC_SUBST([WERROR_CFLAGS]) + [WERROR_CFLAGS=3D-Werror]) =20 nw=3D"$nw -Wduplicated-branches" # Too many false alarms nw=3D"$nw -Wformat-overflow=3D2" # False alarms due to GCC bug 80= 776 @@ -961,7 +960,7 @@ AC_DEFUN nw=3D"$nw -Wtype-limits" nw=3D"$nw -Wunused-parameter" =20 - if test $emacs_cv_clang =3D yes; then + if test "$emacs_cv_clang" =3D yes; then nw=3D"$nw -Wcast-align" nw=3D"$nw -Wdouble-promotion" nw=3D"$nw -Wmissing-braces" @@ -984,11 +983,9 @@ AC_DEFUN gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now gl_WARN_ADD([-Wno-format-nonliteral]) =20 - # More things that clang is unduly picky about. - if test $emacs_cv_clang =3D yes; then + # clang is unduly picky about braces. + if test "$emacs_cv_clang" =3D yes; then gl_WARN_ADD([-Wno-missing-braces]) - gl_WARN_ADD([-Wno-tautological-compare]) - gl_WARN_ADD([-Wno-tautological-constant-out-of-range-compare]) fi =20 # This causes too much noise in the MinGW build @@ -1006,15 +1003,22 @@ AC_DEFUN # define _FORTIFY_SOURCE 2 #endif ]) + ]) =20 - # We use a slightly smaller set of warning options for lib/. - # Remove the following and save the result in GNULIB_WARN_CFLAGS. - nw=3D - nw=3D"$nw -Wunused-macros" +# clang is unduly picky about these regardless of whether +# --enable-gcc-warnings is specified. +if test "$emacs_cv_clang" =3D yes; then + gl_WARN_ADD([-Wno-tautological-compare]) + gl_WARN_ADD([-Wno-tautological-constant-out-of-range-compare]) +fi =20 - gl_MANYWARN_COMPLEMENT([GNULIB_WARN_CFLAGS], [$WARN_CFLAGS], [$nw]) - AC_SUBST([GNULIB_WARN_CFLAGS]) - ]) +# Use a slightly smaller set of warning options for lib/. +nw=3D +nw=3D"$nw -Wunused-macros" +gl_MANYWARN_COMPLEMENT([GNULIB_WARN_CFLAGS], [$WARN_CFLAGS], [$nw]) + +AC_SUBST([WERROR_CFLAGS]) +AC_SUBST([GNULIB_WARN_CFLAGS]) =20 edit_cflags=3D" s,///*,/,g @@ -1033,7 +1037,7 @@ AC_DEFUN recommended for typical use.])], if test "${enableval}" !=3D "no"; then ac_lto_supported=3Dno - if test $emacs_cv_clang =3D yes; then + if test "$emacs_cv_clang" =3D yes; then AC_MSG_CHECKING([whether link-time optimization is supported by cl= ang]) GOLD_PLUGIN=3D`$CC -print-file-name=3DLLVMgold.so 2>/dev/null` if test -x "$GOLD_PLUGIN"; then @@ -1062,7 +1066,7 @@ AC_DEFUN AC_MSG_RESULT([$ac_lto_supported]) if test "$ac_lto_supported" =3D "yes"; then CFLAGS=3D"$CFLAGS $LTO" - if test x$emacs_cv_clang =3D xyes; then + if test "$emacs_cv_clang" =3D yes; then AC_MSG_WARN([Please read INSTALL before using link-time optimization w= ith clang]) # WARNING: 'ar --plugin ...' doesn't work without # command, so plugin name is appended to ARFLAGS. diff --git a/lib/strftime.c b/lib/strftime.c index 18c899d..99bee4e 100644 --- a/lib/strftime.c +++ b/lib/strftime.c @@ -1123,23 +1123,18 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIM= E_ARG (size_t maxsize) if (modifier =3D=3D L_('E')) goto bad_format; =20 - { - /* Use a new variable here instead of reusing number_value - because Clang complains about the self-assignment - generated by DO_NUMBER. */ - ptrdiff_t n =3D ns; - if (width =3D=3D -1) - width =3D 9; - else - { - /* Take an explicit width less than 9 as a precision. *= / - int j; - for (j =3D width; j < 9; j++) - n /=3D 10; - } + number_value =3D ns; + if (width =3D=3D -1) + width =3D 9; + else + { + /* Take an explicit width less than 9 as a precision. */ + int j; + for (j =3D width; j < 9; j++) + number_value /=3D 10; + } =20 - DO_NUMBER (width, n); - } + DO_NUMBER (width, number_value); #endif =20 case L_('n'): diff --git a/src/emacs.c b/src/emacs.c index 08430de..da8df1b 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -832,7 +832,7 @@ main (int argc, char **argv) (https://www.cygwin.com/ml/cygwin/2015-07/msg00096.html). */ struct rlimit rlim; if (getrlimit (RLIMIT_STACK, &rlim) =3D=3D 0 - && rlim.rlim_cur <=3D LONG_MAX) + && 0 <=3D rlim.rlim_cur && rlim.rlim_cur <=3D LONG_MAX) { rlim_t lim =3D rlim.rlim_cur; =20 @@ -866,7 +866,7 @@ main (int argc, char **argv) right thing anyway. */ long pagesize =3D getpagesize (); newlim +=3D pagesize - 1; - if (rlim.rlim_max < newlim) + if (0 <=3D rlim.rlim_max && rlim.rlim_max < newlim) newlim =3D rlim.rlim_max; newlim -=3D newlim % pagesize; =20 --=20 2.9.4 --------------D10D39D00E9C31D0605C55C6--