From: Philipp Stephani <p.stephani2@gmail.com>
To: Paul Eggert <eggert@cs.ucla.edu>, Emacs developers <emacs-devel@gnu.org>
Subject: Re: 27bb4de72b * Port cleanup attribute to Oracle Studio 12.5
Date: Thu, 15 Jun 2017 19:20:26 +0000 [thread overview]
Message-ID: <CAArVCkQZfdtSB8E1PeYhvnVQF=b51DOqSz4y2-gMNo7TK7Ug5Q@mail.gmail.com> (raw)
In-Reply-To: <c0c26da7-e4ba-a592-e4c2-fd4766c505fc@cs.ucla.edu>
[-- Attachment #1: Type: text/plain, Size: 5514 bytes --]
Paul Eggert <eggert@cs.ucla.edu> schrieb am Do., 15. Juni 2017 um 20:46 Uhr:
> On 06/15/2017 05:54 AM, Philipp Stephani wrote:
> > I've considered a couple of options. I think the simplest and most
> > portable one would be to compile as C++, which has destructors built
> > into the language.
>
> That would require some autoconf and makefile hacking, but it would
> work. That is, if modules are enabled, and __attribute__ ((cleanup)) is
> not available but a C++ compiler is available, then the build process
> could use the C++ compiler. Admittedly this is low priority.
>
Alternatively, 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.
>
> > How about using #pragma clang diagnostic push/pop/ignore to ignore the
> > warnings in the specific statements where they arise and we know that
> > they are false positives? I'd much prefer that over disabling them
> > globally in configure, because most of the time the warnings are useful.
>
> Although many warnings are useful, in my experience these particular
> warnings are not useful for Emacs. That is, the hassle they cause by
> false alarms costs more than the benefits of actual bugs that they fix.
> It's OK to disable such warnings globally.
>
> >
> > And I'm still puzzled as to why you're getting the Clang warnings
> > but I
> > am not. Are you using an older Clang? Are you passing it extra
> warning
> > options?
> >
> >
> > I'm using the Apple fork on macOS. It's mostly identical to upstream
> > Clang and compiles Emacs just fine, but it is a fork and not 100%
> > identical. I also get some of the warnings only when building with -O3
> > (haven't checked other optimization levels).
>
> I just now applied the attached patch, configured with:
>
> ./configure --enable-gcc-warnings CC=clang CFLAGS='-O3'
>
> and had no problems on Fedora 25. If you have a problem with this patch,
> can you please send relevant output from 'clang --version' and 'make
> V=1'?
On macOS 10.12.5, current master, and the rlim_t patch reverted:
$ git rev-parse HEAD
1ac8c9bb9b6ba44585ed68b03ebbce659a777041
$ gcc -c -Demacs -I. -I. -I../lib -I../lib -I/usr/X11/include
-I/usr/local/Cellar/dbus/1.10.18/include/dbus-1.0
-I/usr/local/Cellar/dbus/1.10.18/lib/dbus-1.0/include -MMD -MF
deps/emacs.d -MP -I/usr/local/Cellar/gnutls/3.5.13/include
-I/usr/local/Cellar/nettle/3.3/include
-I/usr/local/Cellar/libtasn1/4.12/include
-I/usr/local/Cellar/p11-kit/0.23.7/include/p11-kit-1 -Wno-switch
-Wno-tautological-constant-out-of-range-compare -Wno-pointer-sign
-Wno-string-plus-int -Wno-unknown-attributes -ggdb3 -O0 emacs.c
*emacs.c:835:12: **warning: **comparison of 0 <= unsigned expression is
always true*
* [-Wtautological-compare]*
&& 0 <= rlim.rlim_cur && rlim.rlim_cur <= LONG_MAX)
* ~ ^ ~~~~~~~~~~~~~*
*emacs.c:869:10: **warning: **comparison of 0 <= unsigned expression is
always true*
* [-Wtautological-compare]*
if (0 <= rlim.rlim_max && rlim.rlim_max < newlim)
* ~ ^ ~~~~~~~~~~~~~*
2 warnings generated.
$ ./config.status --config
'--with-modules' '--without-xml2' '--without-pop' '--with-mailutils'
'--enable-checking' '--enable-check-lisp-object-type'
'MAKEINFO=/usr/local/opt/texinfo/bin/makeinfo' 'CFLAGS=-ggdb3 -O0'
(i.e. this doesn't even need --enable-gcc-warnings)
The other case, same repo version, but the other commit reverted:
$ make -C lib-src make-docfile V=1
gcc -Wno-switch -Wno-tautological-constant-out-of-range-compare
-Wno-pointer-sign -Wno-string-plus-int -Wno-unknown-attributes -I.
-I../src -I../lib -I. -I./../src -I./../lib -O3 -save-temps
make-docfile.c ../lib/libgnu.a -o make-docfile
*make-docfile.c:227:19: **warning: **equality comparison with extraneous
parentheses*
* [-Wparentheses-equality]*
if (((*tmp) == '/'))
* ~~~~~~~^~~~~~*
*make-docfile.c:227:19: **note: *remove extraneous parentheses around the
comparison
to silence this warning
if (((*tmp) == '/'))
* ~ ^ ~*
*make-docfile.c:227:19: **note: *use '=' to turn this equality comparison
into an
assignment
if (((*tmp) == '/'))
* ^~*
=
1 warning generated.
$ ./config.status --config
'--with-modules' '--without-xml2' '--without-pop' '--with-mailutils'
'--enable-checking' '--enable-check-lisp-object-type'
'MAKEINFO=/usr/local/opt/texinfo/bin/makeinfo' 'CFLAGS=-O3 -save-temps'
Note that the -save-temps is crucial here, without it the compiler doesn't
look at the preprocessed output.
It's weird that -save-temps generates more warnings, but GCC has similar
issues (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57201). -save-temps
also generates tons of warnings for other files, even without
--enable-gcc-warnings.
Not sure what to do about the -save-temps problem. Maybe that's just
something to document somewhere, because there seems to be little we can do
about it.
$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr
--with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/c++/4.2.1
Apple LLVM version 8.1.0 (clang-802.0.42)
Target: x86_64-apple-darwin16.6.0
Thread model: posix
InstalledDir:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
[-- Attachment #2: Type: text/html, Size: 12465 bytes --]
next prev parent reply other threads:[~2017-06-15 19:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-14 10:29 27bb4de72b * Port cleanup attribute to Oracle Studio 12.5 Philipp Stephani
2017-06-14 18:25 ` Paul Eggert
2017-06-15 12:54 ` Philipp Stephani
2017-06-15 18:46 ` Paul Eggert
2017-06-15 19:20 ` Philipp Stephani [this message]
2017-06-15 20:33 ` Paul Eggert
2017-06-16 16:34 ` Philipp Stephani
2017-06-16 3:19 ` Richard Stallman
2017-06-20 19:18 ` Paul Eggert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAArVCkQZfdtSB8E1PeYhvnVQF=b51DOqSz4y2-gMNo7TK7Ug5Q@mail.gmail.com' \
--to=p.stephani2@gmail.com \
--cc=eggert@cs.ucla.edu \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).