From owner-freebsd-hackers@FreeBSD.ORG Sun Dec 19 12:11:10 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 697B71065670 for ; Sun, 19 Dec 2010 12:11:10 +0000 (UTC) (envelope-from roam@ringlet.net) Received: from erengrad.hoster.bg (erengrad.hoster.bg [77.77.142.9]) by mx1.freebsd.org (Postfix) with ESMTP id D9F788FC0C for ; Sun, 19 Dec 2010 12:11:09 +0000 (UTC) Received: from middenheim.hoster.bg (middenheim.hoster.bg [77.77.142.11]) by erengrad.hoster.bg (Postfix) with ESMTP id 7E0A2DCCD6 for ; Sun, 19 Dec 2010 14:11:08 +0200 (EET) Received: from straylight.ringlet.net (unknown [94.155.53.142]) (Authenticated sender: roam@hoster.bg) by mail.hoster.bg (Postfix) with ESMTP id D537D5C07E for ; Sun, 19 Dec 2010 14:10:49 +0200 (EET) Received: from roam (uid 1000) (envelope-from roam@ringlet.net) id 41602d by straylight.ringlet.net (DragonFly Mail Agent) Sun, 19 Dec 2010 14:10:48 +0200 Date: Sun, 19 Dec 2010 14:10:48 +0200 From: Peter Pentchev To: Alexander Best Message-ID: <20101219121048.GA3835@straylight.ringlet.net> Mail-Followup-To: Alexander Best , freebsd-hackers@freebsd.org References: <20101218200937.GA2932@freebsd.org> <20101218204047.GA4214@straylight.ringlet.net> <20101218212431.GA35554@freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="azLHFNyN32YCQGCU" Content-Disposition: inline In-Reply-To: <20101218212431.GA35554@freebsd.org> User-Agent: Mutt/1.5.20 (2009-06-14) X-MailScanner-ID: D537D5C07E.C949C X-hoster-MailScanner: Found to be clean X-hoster-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=0.001, required 10, autolearn=disabled, UNPARSEABLE_RELAY 0.00) X-hoster-MailScanner-From: roam@ringlet.net X-hoster-MailScanner-To: freebsd-hackers@freebsd.org X-Spam-Status: No Cc: freebsd-hackers@freebsd.org Subject: Re: question about CFLAGS, CXXFLAGS and DEBUG_FLAGS X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Dec 2010 12:11:10 -0000 --azLHFNyN32YCQGCU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Dec 18, 2010 at 09:24:31PM +0000, Alexander Best wrote: > On Sat Dec 18 10, Peter Pentchev wrote: > > On Sat, Dec 18, 2010 at 08:09:37PM +0000, Alexander Best wrote: > > > hi there, > > >=20 > > > i just stumbled over these lines: > > >=20 > > > otaku% grep -n \${DEBUG_FLAGS} /usr/share/mk/bsd.prog.mk > > > 24:CFLAGS+=3D${DEBUG_FLAGS} > > > 25:CXXFLAGS+=3D${DEBUG_FLAGS} > > >=20 > > > is it really necessary to assign the debug flags to both CFLAGS *and*= CXXFLAGS? > >=20 > > Uhm... yes, so they can be used in both C and C++ programs :) > > ...or are you making the mistake I've made too many times (and still > > make sometimes) of confusing CXXFLAGS with CPPFLAGS? :) >=20 > *hehehe* i don't think so. Nah, just making sure, no offense intended :) > i just saw a lot of these lines in buildworld: >=20 > clang++ -O2 -pipe -DNDEBUG -g -I/usr/obj/usr/subversion-src/tmp/legacy/us= r/include -I/usr/subversion-src/gnu/usr.bin/gperf/../../../contrib/gperf/li= b -I/usr/subversion-src/gnu/usr.bin/gperf -g -c /usr/subversion-src/gnu/usr= =2Ebin/gperf/../../../contrib/gperf/lib/hash.cc > clang++: warning: argument unused during compilation: '-g' > clang++: warning: argument unused during compilation: '-g' >=20 > as you can see -g gets specified twice, so i thought maybe adding -g to > CFLAGS makes adding it to CXXFLAGS obsolete. Well, according to my copy of src/share/mk/sys.mk (8.x-STABLE), if the user does not override CXXFLAGS, they are copied from CFLAGS with some exceptions. Thus, it does seem sensible to add -g to both sets of flags - yes, if no CXXFLAGS are specified, the -g will be doubled, but if CXXFLAGS *are* specified in the environment or on the make(1) command line, then only one -g will be added. Maybe a better solution could be to somehow test for empty CXXFLAGS in sys.mk and set another variable that says "we've copied those over", and then only add DEBUG_FLAGS to CXXFLAGS if that variable is not set, but I'm not sure if it's really worth it. Thanks for bringing this up - I wasn't aware of the fact that CXXFLAGS were copied over unless overridden :) Learn something new every day, I guess. G'luck, Peter --=20 Peter Pentchev roam@space.bg roam@ringlet.net roam@FreeBSD.org PGP key: http://people.FreeBSD.org/~roam/roam.key.asc Key fingerprint FDBA FD79 C26F 3C51 C95E DF9E ED18 B68D 1619 4553 No language can express every thought unambiguously, least of all this one. --azLHFNyN32YCQGCU Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iQIcBAEBCAAGBQJNDfZCAAoJEGUe77AlJ98TCjcQALbJQ9z/8SO8vbjXUNyr7iwl nkZddxwG93iFq0OIpoLp15NS4QFiBRoUo+LUPblVn9SPLDf0LNpgUE+wFyIlyY5S t0N99lqethjqsLsPedim0nSFPDYJnkM1mSod1IKVL5fmq5+Hpwlp6mg4bQZ7kaE1 z5dzzuCqcK8HdUAytU8VQwsmyG3oUklg80YzLAozXWZSjN+yVCxN3ZqrDknxSKWZ 2+cVm5rJmWCdU6f9mQg+h10/EaoPRpUxk7xEtq0CzTbSzceXtKmd8HONPmojpEBt WGZM0UjWMaX1B1MJtXmWrNQX+KAhFpqJMpZFuqwvOe0K9tHnTPS+r/RirirF7/VV aNBd8uqHn9tU4R/TAwbm+0a7S4cTyNuHqJ06kw6o3uh1BAjunoA4CX14dJkkt94v zxz6ci2epSDHwaXhllMO3tSI3x5L/jjI5dQHXQDaOSs1mr5PhLcmlf0N0nEWfjFR Zm5NiQDKP71GKMIcNB62vlew74KQkRa0wXXXSKJ6dRcwaZBVtF6jQPVBlM96xiBk RK4algM1Q/lsoT7Tx+1DFH401bJrt2mwDOY9G91N8G6UJLwhStIv3yWKCKm8iCJB lhL0bW/DJInvS/8FDe0HXuJRI8fLzH68CUB4nlu3lJK0+635xlwEZsY7JR2GA6Ai szUkfqBWS2faof1k3n/3 =crhz -----END PGP SIGNATURE----- --azLHFNyN32YCQGCU--