This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA 1/3] Fix "fall through" comments


>>>>> "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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]