Bug 180365

Summary: [bsd.cpu.mk] [patch] Not attach ${_CPUCFLAGS} to CXXFLAGS
Product: Base System Reporter: Norikatsu Shigemura <nork>
Component: miscAssignee: freebsd-bugs (Nobody) <bugs>
Status: Open ---    
Severity: Affects Only Me Keywords: patch
Priority: Normal    
Version: 10.0-CURRENT   
Hardware: Any   
OS: Any   

Description Norikatsu Shigemura freebsd_committer freebsd_triage 2013-07-07 17:20:00 UTC
In share/mk/bsd.cpu.mk, ${_CPUCFLAGS} is added to CFLAGS.
But CXXFLAGS doesn't.  If CXXFLAGS doesn't set, CXXFLAGS=${CFLAGS}.
So we don't almost notice thus issue.

BTW, ${_CPUCFLAGS} should be added to CXXFLAGS,
because C binaries and C++ binaries are combined multiple -mcpu=XXXX.
Even if thus thing almost no problem, but it's wrong for optimization.

Fix: 

.if !defined(NO_CPU_CFLAGS)
 CFLAGS += ${_CPUCFLAGS}
+CXXFLAGS += ${_CPUCFLAGS}
 .endif--0FWefJ7gmV6krGXrq5Uw3GRZCJViUTRkyvuSt4UWHQ0CBqZG
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

Index: share/mk/bsd.cpu.mk
===================================================================
--- share/mk/bsd.cpu.mk       (revision 252953)
+++ share/mk/bsd.cpu.mk       (working copy)
@@ -259,4 +259,5 @@
How-To-Repeat: $ cd /usr/src
$ make -VCFLAGS -VCXXFLAGS
-O2 -pipe -march=corei7
-O2 -pipe -march=corei7
$ env CFLAGS="-O2" CXXFLAGS="-O2" make -VCFLAGS -VCXXFLAGS
-O2 -march=corei7
-O2
$ env CFLAGS="-O2" make -VCFLAGS -VCXXFLAGS
-O2 -march=corei7
-O2 -march=corei7

$ cd /usr/ports/lang/perl5.16
$ make -VCFLAGS -VCXXFLAGS
-O2 -pipe -march=corei7 -fno-strict-aliasing
-O2 -pipe -march=corei7 -fno-strict-aliasing
$ CFLAGS="-O2" CXXFLAGS="-O2" make -VCFLAGS -VCXXFLAGS
-O2 -march=corei7 -fno-strict-aliasing
-O2
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:00:34 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 2 Graham Perrin freebsd_committer freebsd_triage 2022-10-17 12:38:39 UTC
Keyword: 

    patch
or  patch-ready

– in lieu of summary line prefix: 

    [patch]

* bulk change for the keyword
* summary lines may be edited manually (not in bulk). 

Keyword descriptions and search interface: 

    <https://bugs.freebsd.org/bugzilla/describekeywords.cgi>