From owner-freebsd-arch@FreeBSD.ORG Sat Jun 21 19:08:05 2003 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BCECD37B401 for ; Sat, 21 Jun 2003 19:08:05 -0700 (PDT) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8851743FAF for ; Sat, 21 Jun 2003 19:08:04 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from katana.zip.com.au (katana.zip.com.au [61.8.7.246]) by mailman.zeta.org.au (8.9.3p2/8.8.7) with ESMTP id MAA30555; Sun, 22 Jun 2003 12:07:58 +1000 Date: Sun, 22 Jun 2003 12:07:58 +1000 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: David Schultz In-Reply-To: <20030622005124.GA59673@HAL9000.homeunix.com> Message-ID: <20030622114150.L54976@gamplex.bde.org> References: <20030622005124.GA59673@HAL9000.homeunix.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: arch@freebsd.org Subject: Re: Per-source CFLAGS X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jun 2003 02:08:06 -0000 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