From: Samuel Bronson <naesten@gmail.com>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: emacs-devel@gnu.org
Subject: Re: gl_MANYWARN_ALL_GCC() leads to many spurious warnings
Date: Sat, 7 Jul 2012 20:41:17 -0400 [thread overview]
Message-ID: <66583BA3-F963-45E2-A543-18F242B3DD64@gmail.com> (raw)
In-Reply-To: <4FF893CD.2050403@cs.ucla.edu>
On Jul 7, 2012, at 3:53 PM, Paul Eggert wrote:
> On 07/06/2012 03:38 PM, Samuel Bronson wrote:
>
>> why does it use flags like -Wunreachable-code (which was so buggy
>> that it eventually got yanked -- it's now silently ignored)
>
> The big picture is that --enable-gcc-warnings hasn't been
> ironed out --with-ns. This can be fixed, and I expect it
> will find a few real bugs along with many things that are
> just nit cleanups, but it'll take some work. Is this
> something you'd like to help out with? It could be combined
> with the idea of maintaining another configure-time option
> useful for finding bugs on Apple.
Yeah, I've actually started trying to get rid of a lot of warnings in
my own tree already; I've been waiting on my copyright assignment
papers before actually submitting.
At this point I don't think the warnings will turn up much in the way
of actual bugs; it is turning up a fair amount of seemingly redundant
code, though.
I did find one in GCC 4.7.1, though; it gives warnings like this:
/Users/user/hacking/emacs/src/nsterm.m: In function '-[EmacsView
markedRange]':
/Users/user/hacking/emacs/src/nsterm.m:5041:5: warning: format not a
string literal and no format arguments [-Wformat-security]
for calls that most assuredly do use string literals:
- (NSRange)markedRange
{
NSRange rng = workingText != nil
? NSMakeRange (0, [workingText length]) : NSMakeRange
(NSNotFound, 0);
if (NS_KEYLOG)
NSLog (@"markedRange request");
return rng;
}
given this declaration (from NSObjCRuntime.h):
FOUNDATION_EXPORT void NSLog(NSString *format, ...)
__attribute__((format(__NSString__, 1, 2)));
> I started on this task, checking in the results in trunk bzr
> 108941, but there's lots more where that came from and to be
> honest I don't understand the --with-ns code that well. I
> did see some unused-macro warnings but they seemed correct
> to me -- perhaps I am missing something? Anyway, you can
> look at the diffs in 108941 to see how to go about this,
> and/or to let me know what I did wrong.
>
> Anyway, to get back to your question, I suspect
> -Wunreachable-code was there because it is harmless with the
> latest GCC, so nobody bothered to remove it. Since this
> flag doesn't ever help I removed it in trunk bzr 108941.
>
>> and -Wsync-nand (which is totally irrelevant, and warns that this
>> warning isn't allowed for Objective C code)
>
> Same thing -- this flag never bothered anybody in the
> --without-ns world. Since it never helps either, I removed
> it too.
Fair enough, I guess.
>> and -Wunused-macros (which seems rather buggy in GCC 4.7.1 -- it
>> doesn't seem to count appearing in an #ifdef as a use?).
>
> I don't observe a bug here. The following program compiles
> just fine with GCC 4.7.1, with -Wunused-macros. (This is on
> Fedora 15 x86-64.)
>
> #define FOO bar
> #ifdef FOO
> int main (void) { return 0; }
> #endif
>
> What bug do you see?
Well, okay, it doesn't seem *quite* buggy in GCC 4.7.1 -- it just
seems to solve the wrong problem, based on what it does with regex.c
when building in lib-src:
/sw/bin/ccache /sw/bin/gcc-fsf-4.7 -std=gnu99 -c -Wall -W -Wformat-
y2k -Wformat-security -Winit-self -Wmissing-include-dirs -Wunused -
Wunknown-pragmas -Wstrict-aliasing -Wdeclaration-after-statement -
Wunsafe-loop-optimizations -Wpointer-arith -Wbad-function-cast -Wcast-
align -Wwrite-strings -Wstrict-prototypes -Wold-style-definition -
Wmissing-prototypes -Wmissing-declarations -Wmissing-noreturn -
Wmissing-format-attribute -Wpacked -Wunreachable-code -Winvalid-pch -
Wvolatile-register-var -Wdisabled-optimization -Wbuiltin-macro-
redefined -Wmudflap -Wpacked-bitfield-compat -Wsync-nand -Wattributes -
Wcoverage-mismatch -Wunused-macros -Wabi -Wcpp -Wdeprecated -
Wdeprecated-declarations -Wdiv-by-zero -Wdouble-promotion -Wendif-
labels -Wextra -Wformat-contains-nul -Wformat-extra-args -Wformat-zero-
length -Wformat=2 -Wmultichar -Wnormalized=nfc -Woverflow -Wpointer-to-
int-cast -Wpragmas -Wsuggest-attribute=noreturn -Wtrampolines -Wno-
missing-field-initializers -Wno-sign-compare -Wno-type-limits -Wno-
switch -Wno-unused-parameter -Wno-format-nonliteral -Wno-logical-op -
fdiagnostics-show-option -funit-at-a-time -I. -I../src -I../lib -I/
Users/user/hacking/emacs/lib-src -I/Users/user/hacking/emacs/lib-
src/../src -I/Users/user/hacking/emacs/lib-src/../lib -DXASSERTS=1 -g
-O2 -DCONFIG_BROKETS -DINHIBIT_STRING_HEADER \
/Users/user/hacking/emacs/lib-src/../src/regex.c
/Users/user/hacking/emacs/lib-src/../src/regex.c:805:0: warning: macro
"CHARSET_RANGE_TABLE_BITS" is not used [-Wunused-macros]
/Users/user/hacking/emacs/lib-src/../src/regex.c:268:0: warning: macro
"CHAR_HEAD_P" is not used [-Wunused-macros]
/Users/user/hacking/emacs/lib-src/../src/regex.c:269:0: warning: macro
"SINGLE_BYTE_CHAR_P" is not used [-Wunused-macros]
/Users/user/hacking/emacs/lib-src/../src/regex.c:1880:0: warning:
macro "EXTEND_RANGE_TABLE" is not used [-Wunused-macros]
/Users/user/hacking/emacs/lib-src/../src/regex.c:1890:0: warning:
macro "SET_RANGE_TABLE_WORK_AREA_BIT" is not used [-Wunused-macros]
/Users/user/hacking/emacs/lib-src/../src/regex.c:270:0: warning: macro
"SAME_CHARSET_P" is not used [-Wunused-macros]
/Users/user/hacking/emacs/lib-src/../src/regex.c:285:0: warning: macro
"BYTE8_TO_CHAR" is not used [-Wunused-macros]
/Users/user/hacking/emacs/lib-src/../src/regex.c:284:0: warning: macro
"MAKE_CHAR" is not used [-Wunused-macros]
/Users/user/hacking/emacs/lib-src/../src/regex.c:263:0: warning: macro
"CHARSET_LEADING_CODE_BASE" is not used [-Wunused-macros]
/Users/user/hacking/emacs/lib-src/../src/regex.c:262:0: warning: macro
"CHAR_CHARSET" is not used [-Wunused-macros]
/Users/user/hacking/emacs/lib-src/../src/regex.c:1903:0: warning:
macro "SET_RANGE_TABLE_WORK_AREA" is not used [-Wunused-macros]
(It seems that these macros are only used #ifdef emacs)
next prev parent reply other threads:[~2012-07-08 0:41 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-06 21:17 gl_MANYWARN_ALL_GCC() leads to many spurious warnings Samuel Bronson
2012-07-06 21:41 ` Paul Eggert
2012-07-06 22:38 ` Samuel Bronson
2012-07-07 19:53 ` Paul Eggert
2012-07-08 0:41 ` Samuel Bronson [this message]
2012-07-08 7:32 ` Paul Eggert
2012-07-08 14:10 ` Samuel Bronson
2012-07-09 2:15 ` Paul Eggert
2012-07-09 15:23 ` Samuel Bronson
2012-07-10 18:07 ` Samuel Bronson
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=66583BA3-F963-45E2-A543-18F242B3DD64@gmail.com \
--to=naesten@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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.