Re: a more sane way to override optimization flags in gbuild

2017-11-29 Thread Jim Jagielski
I'm just concerned about the CXXFLAGS interaction

The proposed patch breaks how I expect many people
are building AOO and it's a regression that, unless
we are super clear about it, would bite a lot of
people.

> On Nov 28, 2017, at 6:13 PM, Don Lewis  wrote:
> 
> On 28 Nov, Jim Jagielski wrote:
>> Wouldn't it make sense to do something like LOCAL_CFLAGS which
>> could then be manipulated?...
> 
> It depends on what the goal is.  What would be nice is if debug flags
> and optimization flags could be specified from the environment in CFLAGS
> to override the defaults, but the per-target optimization level would
> override that if it was lower.  Sounds difficult, though ...
> 
> 
> -
> To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org
> For additional commands, e-mail: dev-h...@openoffice.apache.org
> 


-
To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org
For additional commands, e-mail: dev-h...@openoffice.apache.org



Re: a more sane way to override optimization flags in gbuild

2017-11-29 Thread Don Lewis
On 29 Nov, Jim Jagielski wrote:
> I'm just concerned about the CXXFLAGS interaction
> 
> The proposed patch breaks how I expect many people
> are building AOO and it's a regression that, unless
> we are super clear about it, would bite a lot of
> people.

How many people set CXXFLAGS in the environment?

Another way to do this is to change the gb_LinkTarget_set_*_optimization
functions to override CXXFLAGS, etc. instead of gb_COMPILEROPTFLAGS.
That would basically return us to the status quo where the usual way of
doing per-target overrides to this point has been:

# Work around bug in gcc 4.2 / 4.3, see
# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35182
ifeq ($(COM),GCC)
$(eval $(call gb_Library_add_cxxobjects,sc,\
sc/source/ui/unoobj/chart2uno \
, $(gb_COMPILERNOOPTFLAGS) $(gb_LinkTarget_EXCEPTIONFLAGS) \
))
else
$(eval $(call gb_Library_add_exception_objects,sc,\
sc/source/ui/unoobj/chart2uno \
))
endif

which manages to lose the debug flags.


-
To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org
For additional commands, e-mail: dev-h...@openoffice.apache.org



Re: a more sane way to override optimization flags in gbuild

2017-11-29 Thread Peter kovacs
+1. I have to adjust build flags in order to reduce my log rubbish at least a 
bit.

Am 29. November 2017 14:54:31 MEZ schrieb Jim Jagielski :
>I'm just concerned about the CXXFLAGS interaction
>
>The proposed patch breaks how I expect many people
>are building AOO and it's a regression that, unless
>we are super clear about it, would bite a lot of
>people.
>
>> On Nov 28, 2017, at 6:13 PM, Don Lewis  wrote:
>> 
>> On 28 Nov, Jim Jagielski wrote:
>>> Wouldn't it make sense to do something like LOCAL_CFLAGS which
>>> could then be manipulated?...
>> 
>> It depends on what the goal is.  What would be nice is if debug flags
>> and optimization flags could be specified from the environment in
>CFLAGS
>> to override the defaults, but the per-target optimization level would
>> override that if it was lower.  Sounds difficult, though ...
>> 
>> 
>> -
>> To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org
>> For additional commands, e-mail: dev-h...@openoffice.apache.org
>> 
>
>
>-
>To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org
>For additional commands, e-mail: dev-h...@openoffice.apache.org

-
To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org
For additional commands, e-mail: dev-h...@openoffice.apache.org



Re: a more sane way to override optimization flags in gbuild

2017-11-29 Thread Don Lewis
On 29 Nov, Jim Jagielski wrote:
> I'm just concerned about the CXXFLAGS interaction
> 
> The proposed patch breaks how I expect many people
> are building AOO and it's a regression that, unless
> we are super clear about it, would bite a lot of
> people.

How about this:

Index: main/framework/Library_fwk.mk
===
--- main/framework/Library_fwk.mk   (revision 1816518)
+++ main/framework/Library_fwk.mk   (working copy)
@@ -61,6 +61,11 @@
$(gb_STDLIBS) \
 ))
 
+# i126622 - Base 4.1.2 does not open Tables and Queries in Mac OSX
+ifeq ($(OS),MACOSX)
+$(call 
gb_LinkTarget_set_cxx_optimization,framework/source/loadenv/loadenv,$(gb_COMPILEROPT1FLAGS))
+endif
+
 $(eval $(call gb_Library_add_exception_objects,fwk,\
framework/source/accelerators/acceleratorcache \
framework/source/accelerators/acceleratorconfiguration \
@@ -190,10 +195,4 @@
framework/source/xml/imagesdocumenthandler \
 ))
 
-# i126622 - Base 4.1.2 does not open Tables and Queries in Mac OSX
-ifeq ($(OS),MACOSX)
-$(call gb_CxxObject_get_target,framework/source/loadenv/loadenv):\
-   T_CXXFLAGS := $(gb_LinkTarget_CXXFLAGS) $(gb_LinkTarget_EXCEPTIONFLAGS) 
$(gb_COMPILERNOOPTFLAGS)
-endif
-
 # vim: set noet sw=4 ts=4:
Index: main/solenv/gbuild/LinkTarget.mk
===
--- main/solenv/gbuild/LinkTarget.mk(revision 1816518)
+++ main/solenv/gbuild/LinkTarget.mk(working copy)
@@ -333,12 +333,12 @@
 $(call gb_LinkTarget_get_clean_target,$(1)) \
 $(call gb_LinkTarget_get_target,$(1)) : GENCXXOBJECTS :=
 $(call gb_LinkTarget_get_headers_target,$(1)) \
-$(call gb_LinkTarget_get_target,$(1)) : T_CFLAGS := $$(gb_LinkTarget_CFLAGS) 
$(CFLAGS)
+$(call gb_LinkTarget_get_target,$(1)) : T_CFLAGS := $$(gb_LinkTarget_CFLAGS)
 $(call gb_LinkTarget_get_headers_target,$(1)) \
 $(call gb_LinkTarget_get_target,$(1)) : T_CXXFLAGS := 
$$(gb_LinkTarget_CXXFLAGS)
 $(call gb_LinkTarget_get_headers_target,$(1)) \
-$(call gb_LinkTarget_get_target,$(1)) : PCH_CXXFLAGS := 
$$(gb_LinkTarget_CXXFLAGS) $(CXXFLAGS)
-$(call gb_LinkTarget_get_target,$(1)) : T_OBJCXXFLAGS := 
$$(gb_LinkTarget_OBJCXXFLAGS) $(OBJCXXFLAGS)
+$(call gb_LinkTarget_get_target,$(1)) : PCH_CXXFLAGS := 
$$(gb_LinkTarget_CXXFLAGS)
+$(call gb_LinkTarget_get_target,$(1)) : T_OBJCXXFLAGS := 
$$(gb_LinkTarget_OBJCXXFLAGS)
 $(call gb_LinkTarget_get_headers_target,$(1)) \
 $(call gb_LinkTarget_get_target,$(1)) : DEFS := $$(gb_LinkTarget_DEFAULTDEFS) 
$(CPPFLAGS)
 $(call gb_LinkTarget_get_headers_target,$(1)) \
@@ -367,10 +367,10 @@
 $(call gb_LinkTarget_get_dep_target,$(1)) : CXXOBJECTS := 
 $(call gb_LinkTarget_get_dep_target,$(1)) : OBJCXXOBJECTS :=
 $(call gb_LinkTarget_get_dep_target,$(1)) : GENCXXOBJECTS :=
-$(call gb_LinkTarget_get_dep_target,$(1)) : T_CFLAGS := 
$$(gb_LinkTarget_CFLAGS) $(CFLAGS)
+$(call gb_LinkTarget_get_dep_target,$(1)) : T_CFLAGS := 
$$(gb_LinkTarget_CFLAGS)
 $(call gb_LinkTarget_get_dep_target,$(1)) : T_CXXFLAGS := 
$$(gb_LinkTarget_CXXFLAGS)
-$(call gb_LinkTarget_get_dep_target,$(1)) : PCH_CXXFLAGS := 
$$(gb_LinkTarget_CXXFLAGS) $(CXXFLAGS)
-$(call gb_LinkTarget_get_dep_target,$(1)) : T_OBJCXXFLAGS := 
$$(gb_LinkTarget_OBJCXXFLAGS) $(OBJCXXFLAGS)
+$(call gb_LinkTarget_get_dep_target,$(1)) : PCH_CXXFLAGS := 
$$(gb_LinkTarget_CXXFLAGS)
+$(call gb_LinkTarget_get_dep_target,$(1)) : T_OBJCXXFLAGS := 
$$(gb_LinkTarget_OBJCXXFLAGS)
 $(call gb_LinkTarget_get_dep_target,$(1)) : DEFS := 
$$(gb_LinkTarget_DEFAULTDEFS) $(CPPFLAGS)
 $(call gb_LinkTarget_get_dep_target,$(1)) : PCH_DEFS := 
$$(gb_LinkTarget_DEFAULTDEFS) $(CPPFLAGS)
 $(call gb_LinkTarget_get_dep_target,$(1)) : INCLUDE := 
$$(gb_LinkTarget_INCLUDE)
@@ -477,9 +477,24 @@
 $(call gb_LinkTarget_get_dep_target,$(1)) : T_OBJCXXFLAGS := $(2)
 endif
 endif
+endef
 
+define gb_LinkTarget_set_c_optimization
+$(call gb_CObject_get_target,$(1)) : CFLAGS := $(filter-out 
$(gb_COMPILEROPTFLAGS),$(CFLAGS)) $(2)
 endef
 
+define gb_LinkTarget_set_cxx_optimization
+$(call gb_CxxObject_get_target,$(1)) : CXXFLAGS := $(filter-out 
$(gb_COMPILEROPTFLAGS),$(CXXFLAGS)) $(2)
+endef
+
+define gb_LinkTarget_set_gencxx_optimization
+$(call gb_GenCxxObject_get_target,$(1)) : CXXFLAGS := $(filter-out 
$(gb_COMPILEROPTFLAGS),$(CXXFLAGS)) $(2)
+endef
+
+define gb_LinkTarget_set_objcxx_optimization
+$(call gb_ObjCxxObject_get_target,$(1)) : OBJCXXFLAGS := $(filter-out 
$(gb_COMPILEROPTFLAGS),$(OBJCXXFLAGS)) $(2)
+endef
+
 define gb_LinkTarget_set_include
 $(call gb_LinkTarget_get_headers_target,$(1)) \
 $(call gb_LinkTarget_get_target,$(1)) : INCLUDE := $(2)
@@ -635,7 +650,7 @@
 
 $(call gb_LinkTarget_get_target,$(1)) : $(call gb_GenCxxObject_get_target,$(2))
 $(call gb_GenCxxObject_get_source,$(2)) : | $(call 
gb_LinkTarget_get_headers_target,$(1))
-$(call gb_GenCxxObject_get_target,$(2)) : T_CXXFLAGS += $(3) $(CXXFLAGS)
+$(call gb_GenCxxObject_get_target,$(2)) : T_CXXFLAGS += $(3)
 
 ifeq ($(gb_FU

Re: a more sane way to override optimization flags in gbuild

2017-11-29 Thread Peter kovacs
The bug mentioned is referring to a gcc bug in 4.2.x. The bugtrackerlink claims 
it is fixed in 4.3.x
Do we need to keep these workarounds?
Maybe we can drop this all together. Would raise maintainability in general.
Who uses 4.2.x compilers?

Am 29. November 2017 19:16:29 MEZ schrieb Don Lewis :
>On 29 Nov, Jim Jagielski wrote:
>> I'm just concerned about the CXXFLAGS interaction
>> 
>> The proposed patch breaks how I expect many people
>> are building AOO and it's a regression that, unless
>> we are super clear about it, would bite a lot of
>> people.
>
>How many people set CXXFLAGS in the environment?
>
>Another way to do this is to change the
>gb_LinkTarget_set_*_optimization
>functions to override CXXFLAGS, etc. instead of gb_COMPILEROPTFLAGS.
>That would basically return us to the status quo where the usual way of
>doing per-target overrides to this point has been:
>
># Work around bug in gcc 4.2 / 4.3, see
># http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35182
>ifeq ($(COM),GCC)
>$(eval $(call gb_Library_add_cxxobjects,sc,\
>sc/source/ui/unoobj/chart2uno \
>, $(gb_COMPILERNOOPTFLAGS) $(gb_LinkTarget_EXCEPTIONFLAGS) \
>))
>else
>$(eval $(call gb_Library_add_exception_objects,sc,\
>sc/source/ui/unoobj/chart2uno \
>))
>endif
>
>which manages to lose the debug flags.
>
>
>-
>To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org
>For additional commands, e-mail: dev-h...@openoffice.apache.org

-
To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org
For additional commands, e-mail: dev-h...@openoffice.apache.org



Re: a more sane way to override optimization flags in gbuild

2017-11-29 Thread Don Lewis
On 30 Nov, Peter kovacs wrote:
> The bug mentioned is referring to a gcc bug in 4.2.x. The bugtrackerlink 
> claims it is fixed in 4.3.x
> Do we need to keep these workarounds?
> Maybe we can drop this all together. Would raise maintainability in general.
> Who uses 4.2.x compilers?

RHEL / CentOS 5 uses 4.1.x.  RHEL / CentOS 6 uses 4.4.x.  Versions of
FreeBSD without clang use 4.2.1 as the system compiler, but the FreeBSD
port brought in a newer version of GCC in that case.

There are a whole bunch of these compiler bug workarounds in the
makefiles, and many of them are not well documented.  It would be nice
to yank them out, but that would require a lot of testing so that we
don't revive old bugs.

The dmake build has $(CCNUMVER), which encodes the compiler version so
that it is able to enable these workarounds when building with a broken
compiler.  Unfortunately, $(CCNUMVER) is not available on the gbuild
side.  That's why the FreeBSD port includes a whole bunch of patches
that I haven't upstreamed. The FreeBSD port is able to conditionally
apply the patches when it detects it is using certain compiler versions.

This new optimization override mechanism should make maintenance easier
since it only requires making a change to the .mk file in one place. The
old method requires two sets of edits per workaround.


-
To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org
For additional commands, e-mail: dev-h...@openoffice.apache.org