Re: Kernel build error in hwpmc with system GNU cc

From: Davide Italiano <davide_at_freebsd.org>
Date: Thu, 2 May 2013 15:36:17 +0200
On Thu, May 2, 2013 at 3:10 PM, Dimitry Andric <dim_at_freebsd.org> wrote:
> On 2013-05-02 12:06, Davide Italiano wrote:
>>
>> On Thu, May 2, 2013 at 8:43 AM, Andrey Chernov <ache_at_freebsd.org> wrote:
>>>
>>> cc1: warnings being treated as errors
>>> /usr/src/sys/modules/hwpmc/../../dev/hwpmc/hwpmc_core.c: In function
>>> 'iap_allocate_pmc':
>>> /usr/src/sys/modules/hwpmc/../../dev/hwpmc/hwpmc_core.c:1935: warning:
>>> 'map' may be used uninitialized in this function
>
> ...
>
>> You can find a patch attached at the end of this mail that should fix
>> the problem.
>
>
> Hm, the warning seems to be bogus.  Newer versions of gcc (I tried 4.7.3
> and 4.8.1) do not warn about 'map' (though they both warn about another
> variable, which is set, but not used.)
>
>
>
>> More generally speaking, why are you building -CURRENT using GCC while
>> the default compiler has been clang since November 2012?
>> I understand we cannot completely get rid of GCC as long as
>> Tier-2/Tier-3 arch haven't full support for clang and friends, OTOH, I
>> see clang default on amd64 so I guess at some point we should declare
>> GCC not officially supported anymore. Putting the additional burden of
>> testing on the committer because two compilers are supported at the
>> same time doesn't scale really well, at least according to me.
>
>
> Some people still prefer gcc, and while this warning is a bit annoying,
> I see no problem in putting in a workaround.  Using gcc for arches which

Yes, for sure it's not a problem. I try to run 'make universe' when I
commit change, but it's already slow on relatively recent hardware,
and I just found annoying the need of rebuilding the system using two
different compilers (in particular if one of them generates warning
that are bogus, as happened in this case). Other than being
time-expensive, the switch at runtime from clang to GCC was not so
easy for me. In fact, if I try to change from clang to gcc46 and run
'make buildkernel' I get some errors like:

cc1: error: unrecognized command line option '-fformat-extensions'
cc1: warning: unrecognized command line option
"-Wno-error-parentheses-equality" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-error-empty-body"
[enabled by default]
cc1: warning: unrecognized command line option
"-Wno-error-tautological-compare" [enabled by default]
*** [genassym.o] Error code 1

which disappear actually if I re-run buildworld. Maybe I'm missing
something or I'm doing something wrong. But, at the end of the day, I
preferred to have my lazyness winning. Actually, I don't think it
worth the effort.
If there's an easier way to do this, feel free to point me to it.

> default to clang will most likely have to be supported for quite some
> time.
>
> Also, if the external toolchain support ever comes off the ground, it
> will probably become necessary to suppress certain warnings on an
> individual basis; for example, with recent gcc versions, there are quite
> a large number of "variable x set but not used" warnings, which are not
> very useful, most of the time.

Thanks,

-- 
Davide

"There are no solved problems; there are only problems that are more
or less solved" -- Henri Poincare
Received on Thu May 02 2013 - 11:36:18 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:37 UTC