From: Tom Tromey <tom@tromey.com>
To: Yao Qi <qiyaoltc@gmail.com>
Cc: Tom Tromey <tom@tromey.com>,
"gdb-patches\@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [RFA 1/3] Fix "fall through" comments
Date: Wed, 28 Sep 2016 21:58:00 -0000 [thread overview]
Message-ID: <8760pfhjhl.fsf@tromey.com> (raw)
In-Reply-To: <CAH=s-PPkWgxefpzPXtQmdVC79-vWAKso+GDsVyyCf4jbA-pbgA@mail.gmail.com> (Yao Qi's message of "Wed, 28 Sep 2016 19:42:21 +0100")
>>>>> "Yao" == Yao Qi <qiyaoltc@gmail.com> writes:
Tom> On my machine, clang won't build gdb. From memory there was at
Tom> least some issue compiling .c files in c++ mode, but I think there
Tom> were other problems as well.
Yao> We can use option '-x c++' to suppress the warnings, but you are
Yao> right, there are some other problems, like some warning options are
Yao> unknown to clang.
Yeah. I tried it again and there are two issues.
First, clang++ doesn't like the .c extension:
clang-3.8: error: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated
I was able to fix this with:
make CC=clang CXX='clang++ -x c++' CC_LD=clang++
After that I got:
error: unknown warning option '-Wunused-but-set-parameter'; did you mean '-Wunused-parameter'? [-Werror,-Wunknown-warning-option]
error: unknown warning option '-Wunused-but-set-variable'; did you mean '-Wunused-const-variable'? [-Werror,-Wunknown-warning-option]
This is probably an oversight in warning.m4, as in config.log I see:
configure:14316: clang++ -c -g -O2 -Wunused-but-set-parameter conftest.cpp >&5
warning: unknown warning option '-Wunused-but-set-parameter'; did you mean '-Wunused-parameter'? [-Wunknown-warning-option]
1 warning generated.
configure:14316: $? = 0
Adding 'WERROR_CFLAGS=' solves this... but at this point it's fine to
keep fall-through comments, because warnings are disabled anyway.
It's worth noting that I see tons of "unused function" warnings from
vec.h. when building this way. There's definitely some work to be done
here if anybody wants to use clang.
In sum my view is that it's fine to go ahead with the comment approach.
If someone wants to fix up the clang build I can help convert the
comments to an attribute. (The issue with doing it up-front is
discovering the spots that would need a change -- gcc won't tell us what
they are.)
thanks,
Tom
next prev parent reply other threads:[~2016-09-28 21:51 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-27 18:16 [RFA 0/3] Fix some -Wimplicit-fallthrough warnings Tom Tromey
2016-09-27 18:16 ` [RFA 1/3] Fix "fall through" comments Tom Tromey
2016-09-27 21:48 ` Yao Qi
2016-09-27 21:53 ` Tom Tromey
2016-09-28 21:51 ` Yao Qi
2016-09-28 21:58 ` Tom Tromey [this message]
2016-09-30 21:09 ` Yao Qi
2016-09-27 18:16 ` [RFA 2/3] Add missing ATTRIBUTE_NORETURNs Tom Tromey
2016-09-28 7:28 ` Yao Qi
2016-09-28 17:40 ` Tom Tromey
2016-09-28 17:41 ` Yao Qi
2016-09-27 18:52 ` [RFA 3/3] Fix "obvious" fall-through warnings Tom Tromey
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=8760pfhjhl.fsf@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@sourceware.org \
--cc=qiyaoltc@gmail.com \
/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.
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).