Re: Per-source CFLAGS

From: Bruce Evans (bde_at_zeta.org.au)
Date: 06/22/03

  • Next message: David Schultz: "Re: Per-source CFLAGS"
    Date: Sun, 22 Jun 2003 12:07:58 +1000 (EST)
    To: David Schultz <dschultz@OCF.Berkeley.EDU>
    
    

    On Sat, 21 Jun 2003, David Schultz wrote:

    > The following patch adds support for per-file CFLAGS, which gets
    > appended to the command line after the global CFLAGS. I would
    > ...
    > I intend to use this feature for gdtoa, which is technically part
    > of libc, but also on a vendor branch and intended to stay that
    > way. The problem being addressed is that gcc at higher warning
    > levels has some inane warnings that the vendor and I consider
    > wrong, and yet people want to be able to compile libc cleanly at
    > these warning levels. As an example, gcc complains that the
    > expression 'a << b - c' must have parentheses because obviously
    > nobody remembers C's precedence rules. So here's just one
    > potential use of the new feature:

    For this, you really want per-file WARNS, since among other reasons
    compiler-dependent flags shouldn't be put in individual Makefiles.

    > Index: lib/libc/gdtoa/Makefile.inc
    > ===================================================================
    > RCS file: /cvs/src/lib/libc/gdtoa/Makefile.inc,v
    > retrieving revision 1.3
    > diff -u -r1.3 Makefile.inc
    > --- lib/libc/gdtoa/Makefile.inc 5 Apr 2003 22:10:13 -0000 1.3
    > +++ lib/libc/gdtoa/Makefile.inc 2 May 2003 09:31:15 -0000
    > @@ -16,6 +16,7 @@
    > .for src in ${GDTOASRCS}
    > MISRCS+=gdtoa_${src}
    > CLEANFILES+=gdtoa_${src}
    > +CFLAGS_gdtoa_${src}+=-w

    Do you need to turn off all warnings or just ones for non-broken
    precedence and a few other non-broken things? gcc doesn't give
    enough control over individual warnings, but it has -Wno-parentheses
    for turning off not much more than bogus warnings about natural
    precedence.

    > The patch I would actually like reviewed is this one:
    > ...
    > Index: share/mk/sys.mk
    > ===================================================================
    > RCS file: /cvs/src/share/mk/sys.mk,v
    > retrieving revision 1.67
    > diff -u -r1.67 sys.mk
    > --- share/mk/sys.mk 1 Jun 2003 22:13:45 -0000 1.67
    > +++ share/mk/sys.mk 21 Jun 2003 08:56:15 -0000
    > ...
    > @@ -117,7 +117,8 @@
    >
    > # SINGLE SUFFIX RULES
    > .c:
    > - ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC}
    > + ${CC} ${CFLAGS} ${CFLAGS_${.IMPSRC}} ${LDFLAGS} \
    > + -o ${.TARGET} ${.IMPSRC}
    > ...

    Some rules are specified by POSIX, so they can't be changed. I don't
    see how ${CFLAGS} can be per-file directly, so the POSIX spec seems to
    be actively opposed to per-file CFLAGS.

    Bruce
    _______________________________________________
    freebsd-arch@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-arch
    To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"


  • Next message: David Schultz: "Re: Per-source CFLAGS"

    Relevant Pages

    • Re: Per-source CFLAGS
      ... >> I intend to use this feature for gdtoa, ... > Do you need to turn off all warnings or just ones for non-broken ... Per-file CFLAGS can't be used to disable warnings both selectively ...
      (freebsd-arch)
    • Re: OT: Massachusetts Verdict: MS Office Formats Out
      ... Tim wrote: ... >> When I use OpenOffice, and want to save something that I created using ... foolish warnings such as the above "All might not be safe" ... If they don't use any non-exportable feature in a document, ...
      (Fedora)
    • Re: is an attorney really needed????
      ... ever really can be when it comes to human nature but I do not intend to ... Yes I have seen the posts about scammers and the warnings about never ... of our communications and any records related to those communications. ... potential for the marriage going bad but this can be said regardless of ...
      (misc.immigration.usa)
    • Re: pragma warning
      ... >>> Using Win98SE, VC6sp5, ... >>> have warnings. ... >> Jeff Flinn ... > but a 'feature' of the particular function that I'm calling. ...
      (microsoft.public.vc.ide_general)
    • Re: Turn off ALL warnings question?
      ... > feature of a macro? ... I always want to overwrite the current file but do not want to have ... > Set warnings feature but that does not include this message. ...
      (microsoft.public.access.externaldata)