Discussion:
[chromium-dev] How can I overwrite the cflags/cxxflags (rtti and exceptions) in my module? (gn build system)
Samuel Yang
2016-10-20 08:44:16 UTC
Permalink
Hi,

I have my own module and have a BUILD.gn , I have added the flags as below.
However, there are still -fno-rtti and -fno-exceptions after -frtti and
-fexceptions in the compile log.

How can I just enable rtti and exception in my module but disable rtti and
exceptions the others in chromium(It already did)? Great thanks.

cflags = [
"-fexceptions",
"-frtti",
]

cflags_cc = [
"-fexceptions",
"-frtti",
]
--
--
Chromium Developers mailing list: chromium-***@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev+***@chromium.org.
Thiago Farina
2016-10-20 11:02:59 UTC
Permalink
Post by Samuel Yang
Hi,
I have my own module and have a BUILD.gn , I have added the flags as
below. However, there are still -fno-rtti and -fno-exceptions after -frtti
and -fexceptions in the compile log.
How can I just enable rtti and exception in my module but disable rtti and
exceptions the others in chromium(It already did)? Great thanks.
cflags = [
"-fexceptions",
"-frtti",
]
cflags_cc = [
"-fexceptions",
"-frtti",
]
In your BUILD.gn try doing:

configs -= [ "//build/config/gcc:no_exceptions" ]
--
Thiago Farina
--
--
Chromium Developers mailing list: chromium-***@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev+***@chromium.org.
Thiago Farina
2016-10-20 11:06:29 UTC
Permalink
Post by Thiago Farina
Post by Samuel Yang
Hi,
I have my own module and have a BUILD.gn , I have added the flags as
below. However, there are still -fno-rtti and -fno-exceptions after -frtti
and -fexceptions in the compile log.
How can I just enable rtti and exception in my module but disable rtti
and exceptions the others in chromium(It already did)? Great thanks.
cflags = [
"-fexceptions",
"-frtti",
]
cflags_cc = [
"-fexceptions",
"-frtti",
]
configs -= [ "//build/config/gcc:no_exceptions" ]
configs -= [ "//build/config/compiler:no_rtti" ]

configs += [ "//build/config/compiler:rtti" ]

Example:
https://cs.chromium.org/chromium/src/gpu/khronos_glcts_support/BUILD.gn?q=no_exceptions&sq=package:chromium&l=272&dr=C
--
Thiago Farina
--
--
Chromium Developers mailing list: chromium-***@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev+***@chromium.org.
Samuel Yang
2016-10-20 11:52:07 UTC
Permalink
Thank you. It works.

圚 2016幎10月20日星期四 UTC+8䞋午7:08:13Thiago Farina写道
Post by Thiago Farina
Post by Thiago Farina
Post by Samuel Yang
Hi,
I have my own module and have a BUILD.gn , I have added the flags as
below. However, there are still -fno-rtti and -fno-exceptions after -frtti
and -fexceptions in the compile log.
How can I just enable rtti and exception in my module but disable rtti
and exceptions the others in chromium(It already did)? Great thanks.
cflags = [
"-fexceptions",
"-frtti",
]
cflags_cc = [
"-fexceptions",
"-frtti",
]
configs -= [ "//build/config/gcc:no_exceptions" ]
configs -= [ "//build/config/compiler:no_rtti" ]
configs += [ "//build/config/compiler:rtti" ]
https://cs.chromium.org/chromium/src/gpu/khronos_glcts_support/BUILD.gn?q=no_exceptions&sq=package:chromium&l=272&dr=C
--
Thiago Farina
--
--
Chromium Developers mailing list: chromium-***@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev+***@chromium.org.
Samuel Yang
2016-10-21 07:33:21 UTC
Permalink
Is it possible that I only want to particular files enable rtti but not the
whole module?



圚 2016幎10月20日星期四 UTC+8䞋午7:08:13Thiago Farina写道
Post by Thiago Farina
Post by Thiago Farina
Post by Samuel Yang
Hi,
I have my own module and have a BUILD.gn , I have added the flags as
below. However, there are still -fno-rtti and -fno-exceptions after -frtti
and -fexceptions in the compile log.
How can I just enable rtti and exception in my module but disable rtti
and exceptions the others in chromium(It already did)? Great thanks.
cflags = [
"-fexceptions",
"-frtti",
]
cflags_cc = [
"-fexceptions",
"-frtti",
]
configs -= [ "//build/config/gcc:no_exceptions" ]
configs -= [ "//build/config/compiler:no_rtti" ]
configs += [ "//build/config/compiler:rtti" ]
https://cs.chromium.org/chromium/src/gpu/khronos_glcts_support/BUILD.gn?q=no_exceptions&sq=package:chromium&l=272&dr=C
--
Thiago Farina
--
--
Chromium Developers mailing list: chromium-***@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev+***@chromium.org.
Krzysztof Olczyk
2016-10-21 08:49:49 UTC
Permalink
You may put them in the separate source_set-s.
--
Best regards,
*Krzysztof Olczyk*
Software Developer & Architect
TVSDK Core team

Opera TV
Pl. Teatralny 8, 50-051 Wroclaw, Poland
Post by Samuel Yang
Is it possible that I only want to particular files enable rtti but not
the whole module?
圚 2016幎10月20日星期四 UTC+8䞋午7:08:13Thiago Farina写道
Post by Thiago Farina
Post by Thiago Farina
Post by Samuel Yang
Hi,
I have my own module and have a BUILD.gn , I have added the flags as
below. However, there are still -fno-rtti and -fno-exceptions after -frtti
and -fexceptions in the compile log.
How can I just enable rtti and exception in my module but disable rtti
and exceptions the others in chromium(It already did)? Great thanks.
cflags = [
"-fexceptions",
"-frtti",
]
cflags_cc = [
"-fexceptions",
"-frtti",
]
configs -= [ "//build/config/gcc:no_exceptions" ]
configs -= [ "//build/config/compiler:no_rtti" ]
configs += [ "//build/config/compiler:rtti" ]
Example: https://cs.chromium.org/chromium/src/gpu/khronos_gl
cts_support/BUILD.gn?q=no_exceptions&sq=package:chromium&l=272&dr=C
--
Thiago Farina
--
--
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups
"Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an
--
--
Chromium Developers mailing list: chromium-***@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev+***@chromium.org.
u***@gmail.com
2018-11-08 09:35:29 UTC
Permalink
This post might be inappropriate. Click to display it.
David Turner
2018-11-09 10:48:08 UTC
Permalink
What you propose would turn on exceptions and RTTI for _all_ code compiled,
which is not desirable, nor what the initial question was about.

An answer closer to being correct would be to remove the "no_rtti" and
"no_exceptions" configs the specific module, and replace them with "rtti"
and "exceptions", e.g. something like:


source_set("foo_module") {
sources = [ ... ]
...
configs -= [ "//build/config/compiler:no_rtti" ]
configs += [ "//build/config/compiler:rtti" ]
configs -= [ "//build/config/compiler:no_exceptions" ]
configs += [ "//build/config/compiler:exceptions" ]
}
Post by u***@gmail.com
declare_args(){
...
use_rtti = false
use_exceptions = false
...
}
set to false by default.
In the same file, add a switch to config("no_rtti") and config(
config("no_rtti") {
if (!use_rtti) {
if (is_win) {
cflags_cc = [ "/GR-" ]
} else {
cflags_cc = [ "-fno-rtti" ]
cflags_objcc = cflags_cc
}
}
}
config("no_exceptions") {
if (!use_exceptions){
if (is_win) {
# Disables exceptions in the STL.
# libc++ uses the __has_feature macro to control whether to use exceptions,
# so defining this macro is unnecessary. Defining _HAS_EXCEPTIONS to 0 also
# breaks libc++ because it depends on MSVC headers that only provide certain
# declarations if _HAS_EXCEPTIONS is 1. Those MSVC headers do not use
# exceptions, despite being conditional on _HAS_EXCEPTIONS.
if (!use_custom_libcxx) {
defines = [ "_HAS_EXCEPTIONS=0" ]
}
} else {
cflags_cc = [ "-fno-exceptions" ]
cflags_objcc = cflags_cc
}
}
}
gn gen out/default --args='use_rtti=true use_exceptions=true'
圚 2016幎10月20日星期四 UTC+8䞋午4:44:17Samuel Yang写道
Post by Samuel Yang
Hi,
I have my own module and have a BUILD.gn , I have added the flags as
below. However, there are still -fno-rtti and -fno-exceptions after -frtti
and -fexceptions in the compile log.
How can I just enable rtti and exception in my module but disable rtti
and exceptions the others in chromium(It already did)? Great thanks.
cflags = [
"-fexceptions",
"-frtti",
]
cflags_cc = [
"-fexceptions",
"-frtti",
]
--
--
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups
"Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an
To view this discussion on the web visit
https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/494ebd19-0cb2-4087-af39-385d059a42af%40chromium.org
<https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/494ebd19-0cb2-4087-af39-385d059a42af%40chromium.org?utm_medium=email&utm_source=footer>
.
--
--
Chromium Developers mailing list: chromium-***@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev+***@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/CACnJMqqD4-3dy0Z%3DeOUXL6Qj4PfcK-%2B7VWpGbjG-H%2BDdG74HWQ%40mail.gmail.com.
Loading...