Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Mar 1999 10:08:55 -0800 (PST)
From:      John Polstra <jdp@polstra.com>
To:        Sheldon Hearn <sheldonh@iafrica.com>
Cc:        cvs-all@FreeBSD.org, cvs-committers@FreeBSD.org, John Polstra <jdp@FreeBSD.org>, Dmitrij Tejblum <dima@tejblum.dnttm.rssi.ru>
Subject:   Re: cvs commit: src/lib/csu/i386-elf Makefile crtbegin.c crtend.
Message-ID:  <XFMail.990315100855.jdp@polstra.com>
In-Reply-To: <47124.921493522@axl.noc.iafrica.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Sheldon Hearn wrote:
> On Sun, 14 Mar 1999 21:15:57 +0300, Dmitrij Tejblum wrote:
> 
>> Ah! This is the thing that breaks world (namely, groff) with -O3. gcc 
>> eliminate the "unused" code completely, and you cannot fix it by 
>> -Wno-unused or by __unused.
> 
> Does this relate at all to PR bin/10522?

No, that's something different.  It's a known limitation of gcc that
some spurious warnings can come out when no optimization is used.
(And some constructs that should cause valid warnings can be missed.)
That's why it's a bad idea to use -Werror anywhere, any time.  I see
several possible solutions:

1. Outlaw the use of -Werror in any makefiles under /usr/src, and
add a comment warning about its use in /etc/make.conf.

2. Add some magic to the /usr/share/mk/files to silently remove
-Werror from CFLAGS if no optimization is used. I'm pretty sure this
is feasible, modulo bugs in make.  Here's a barely tested possibility:

    _OFLAG:=-O0
    .for i in ${CFLAGS:M-O*}
    _OFLAG:=${i}
    .endfor
    .if ${_OFLAG} == "-O0"
    CFLAGS:=${CFLAGS:N-Werror}
    .endif

3. Like #2, but backwards: silently add -O if -Werror is used and no
optimization was specified.

4. Modify the compiler to do #2 or #3.

I'd personally prefer #1 (because -Werror is a misguided idea IMHO) or
#2 (because it solves the problem without police).  I don't like #3,
because it changes the code that's emitted.  I don't like #4, because
any divergence from standard compilers is a maintenance hassle.

John
---
  John Polstra                                               jdp@polstra.com
  John D. Polstra & Co., Inc.                        Seattle, Washington USA
  "Self-interest is the aphrodisiac of belief."           -- James V. DeLong



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.990315100855.jdp>