* [Qemu-devel] [PATCH] split c and cxx extra flags
@ 2017-06-02 13:07 Bruno Dominguez
2017-06-06 9:18 ` Bruno Dominguez
2017-06-06 9:28 ` Stefan Hajnoczi
0 siblings, 2 replies; 8+ messages in thread
From: Bruno Dominguez @ 2017-06-02 13:07 UTC (permalink / raw)
To: qemu-devel; +Cc: claudio.fontana
There was no possibility to add specific cxx flags using the configure
file. So A new entrance has been created to support it.
Duplication of information in configure and rules.mak. Taking
QEMU_CFLAGS and add them to QEMU_CXXFLAGS, now the value of
QEMU_CXXFLAGS is stored in config-host.mak, so there is no need for
it.
The makefile for libvixl was adding flags for QEMU_CXXFLAGS in
QEMU_CFLAGS because of the addition in rules.mak. That was removed, so
adding them where it should be.
-----
Signed-off-by: Bruno Dominguez <bru.dominguez@gmail.com>
-----
diff --git a/configure b/configure
index 0586ec9..2fff3cc 100755
--- a/configure
+++ b/configure
@@ -91,7 +91,8 @@ update_cxxflags() {
# Set QEMU_CXXFLAGS from QEMU_CFLAGS by filtering out those
# options which some versions of GCC's C++ compiler complain about
# because they only make sense for C programs.
- QEMU_CXXFLAGS=
+ QEMU_CXXFLAGS="$QEMU_CXXFLAGS -D__STDC_LIMIT_MACROS"
+
for arg in $QEMU_CFLAGS; do
case $arg in
-Wstrict-prototypes|-Wmissing-prototypes|-Wnested-externs|\
@@ -102,6 +103,8 @@ update_cxxflags() {
;;
esac
done
+
+
}
compile_object() {
@@ -344,6 +347,9 @@ for opt do
--extra-cflags=*) QEMU_CFLAGS="$QEMU_CFLAGS $optarg"
EXTRA_CFLAGS="$optarg"
;;
+ --extra-cxxflags=*) QEMU_CXXFLAGS="$QEMU_CXXFLAGS $optarg"
+ EXTRA_CXXFLAGS="$optarg"
+ ;;
--extra-ldflags=*) LDFLAGS="$LDFLAGS $optarg"
EXTRA_LDFLAGS="$optarg"
;;
@@ -787,6 +793,8 @@ for opt do
;;
--extra-cflags=*)
;;
+ --extra-cxxflags=*)
+ ;;
--extra-ldflags=*)
;;
--enable-debug-info)
@@ -1304,6 +1312,7 @@ Advanced options (experts only):
--cxx=CXX use C++ compiler CXX [$cxx]
--objcc=OBJCC use Objective-C compiler OBJCC [$objcc]
--extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS
+ --extra-cxxflags=CXXFLAGS append extra CXX compiler flags QEMU_CXXFLAGS
--extra-ldflags=LDFLAGS append extra linker flags LDFLAGS
--make=MAKE use specified make [$make]
--install=INSTALL use specified install [$install]
@@ -1489,37 +1498,6 @@ if test "$bogus_os" = "yes"; then
error_exit "Unrecognized host OS $targetos"
fi
-# Check that the C++ compiler exists and works with the C compiler
-if has $cxx; then
- cat > $TMPC <<EOF
-int c_function(void);
-int main(void) { return c_function(); }
-EOF
-
- compile_object
-
- cat > $TMPCXX <<EOF
-extern "C" {
- int c_function(void);
-}
-int c_function(void) { return 42; }
-EOF
-
- update_cxxflags
-
- if do_cxx $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $LDFLAGS; then
- # C++ compiler $cxx works ok with C compiler $cc
- :
- else
- echo "C++ compiler $cxx does not work with C compiler $cc"
- echo "Disabling C++ specific optional code"
- cxx=
- fi
-else
- echo "No C++ compiler available; disabling C++ specific optional code"
- cxx=
-fi
-
gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
gcc_flags="-Wformat-security -Wformat-y2k -Winit-self
-Wignored-qualifiers $gcc_flags"
gcc_flags="-Wno-missing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
@@ -5063,6 +5041,38 @@ EOF
fi
fi
+# Check that the C++ compiler exists and works with the C compiler.
+# All the QEMU_CXXFLAGS are based on QEMU_CFLAGS. Keep this at the
end to don't miss any other that could be added.
+if has $cxx; then
+ cat > $TMPC <<EOF
+int c_function(void);
+int main(void) { return c_function(); }
+EOF
+
+ compile_object
+
+ cat > $TMPCXX <<EOF
+extern "C" {
+ int c_function(void);
+}
+int c_function(void) { return 42; }
+EOF
+
+ update_cxxflags
+
+ if do_cxx $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $LDFLAGS; then
+ # C++ compiler $cxx works ok with C compiler $cc
+ :
+ else
+ echo "C++ compiler $cxx does not work with C compiler $cc"
+ echo "Disabling C++ specific optional code"
+ cxx=
+ fi
+else
+ echo "No C++ compiler available; disabling C++ specific optional code"
+ cxx=
+fi
+
echo_version() {
if test "$1" = "yes" ; then
echo "($2)"
@@ -5268,6 +5278,7 @@ if test "$mingw32" = "no" ; then
fi
echo "qemu_helperdir=$libexecdir" >> $config_host_mak
echo "extra_cflags=$EXTRA_CFLAGS" >> $config_host_mak
+echo "extra_cxxflags=$EXTRA_CXXFLAGS" >> $config_host_mak
echo "extra_ldflags=$EXTRA_LDFLAGS" >> $config_host_mak
echo "qemu_localedir=$qemu_localedir" >> $config_host_mak
echo "libs_softmmu=$libs_softmmu" >> $config_host_mak
@@ -5906,6 +5917,7 @@ echo "WINDRES=$windres" >> $config_host_mak
echo "CFLAGS=$CFLAGS" >> $config_host_mak
echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak
echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
+echo "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak
echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
if test "$sparse" = "yes" ; then
echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak
diff --git a/disas/libvixl/Makefile.objs b/disas/libvixl/Makefile.objs
index bbe7695..dbf7def 100644
--- a/disas/libvixl/Makefile.objs
+++ b/disas/libvixl/Makefile.objs
@@ -6,6 +6,6 @@ libvixl_OBJS = vixl/utils.o \
# The -Wno-sign-compare is needed only for gcc 4.6, which complains about
# some signed-unsigned equality comparisons which later gcc versions do not.
-$(addprefix $(obj)/,$(libvixl_OBJS)): QEMU_CFLAGS :=
-I$(SRC_PATH)/disas/libvixl $(QEMU_CFLAGS) -Wno-sign-compare
+$(addprefix $(obj)/,$(libvixl_OBJS)): QEMU_CXXFLAGS :=
-I$(SRC_PATH)/disas/libvixl $(QEMU_CXXFLAGS) -Wno-sign-compare
common-obj-$(CONFIG_ARM_A64_DIS) += $(libvixl_OBJS)
diff --git a/rules.mak b/rules.mak
index 1c0eabb..2a2fb72 100644
--- a/rules.mak
+++ b/rules.mak
@@ -20,9 +20,6 @@ MAKEFLAGS += -rR
%.mak:
clean-target:
-# Flags for C++ compilation
-QEMU_CXXFLAGS = -D__STDC_LIMIT_MACROS $(filter-out
-Wstrict-prototypes -Wmissing-prototypes -Wnested-externs
-Wold-style-declaration -Wold-style-definition -Wredundant-decls,
$(QEMU_CFLAGS))
-
# Flags for dependency generation
QEMU_DGFLAGS += -MMD -MP -MT $@ -MF $(@D)/$(*F).d
Bruno
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH] split c and cxx extra flags
2017-06-02 13:07 [Qemu-devel] [PATCH] split c and cxx extra flags Bruno Dominguez
@ 2017-06-06 9:18 ` Bruno Dominguez
2017-06-06 9:28 ` Stefan Hajnoczi
1 sibling, 0 replies; 8+ messages in thread
From: Bruno Dominguez @ 2017-06-06 9:18 UTC (permalink / raw)
To: qemu-devel; +Cc: peter.maydell
Adding Peter Maydell in the cc and removing Claudio Fontana (It fails
sending to that address)
Bruno.
2017-06-02 14:07 GMT+01:00 Bruno Dominguez <bru.dominguez@gmail.com>:
> There was no possibility to add specific cxx flags using the configure
> file. So A new entrance has been created to support it.
>
> Duplication of information in configure and rules.mak. Taking
> QEMU_CFLAGS and add them to QEMU_CXXFLAGS, now the value of
> QEMU_CXXFLAGS is stored in config-host.mak, so there is no need for
> it.
>
> The makefile for libvixl was adding flags for QEMU_CXXFLAGS in
> QEMU_CFLAGS because of the addition in rules.mak. That was removed, so
> adding them where it should be.
>
> -----
> Signed-off-by: Bruno Dominguez <bru.dominguez@gmail.com>
> -----
>
> diff --git a/configure b/configure
> index 0586ec9..2fff3cc 100755
> --- a/configure
> +++ b/configure
> @@ -91,7 +91,8 @@ update_cxxflags() {
> # Set QEMU_CXXFLAGS from QEMU_CFLAGS by filtering out those
> # options which some versions of GCC's C++ compiler complain about
> # because they only make sense for C programs.
> - QEMU_CXXFLAGS=
> + QEMU_CXXFLAGS="$QEMU_CXXFLAGS -D__STDC_LIMIT_MACROS"
> +
> for arg in $QEMU_CFLAGS; do
> case $arg in
> -Wstrict-prototypes|-Wmissing-prototypes|-Wnested-externs|\
> @@ -102,6 +103,8 @@ update_cxxflags() {
> ;;
> esac
> done
> +
> +
> }
>
> compile_object() {
> @@ -344,6 +347,9 @@ for opt do
> --extra-cflags=*) QEMU_CFLAGS="$QEMU_CFLAGS $optarg"
> EXTRA_CFLAGS="$optarg"
> ;;
> + --extra-cxxflags=*) QEMU_CXXFLAGS="$QEMU_CXXFLAGS $optarg"
> + EXTRA_CXXFLAGS="$optarg"
> + ;;
> --extra-ldflags=*) LDFLAGS="$LDFLAGS $optarg"
> EXTRA_LDFLAGS="$optarg"
> ;;
> @@ -787,6 +793,8 @@ for opt do
> ;;
> --extra-cflags=*)
> ;;
> + --extra-cxxflags=*)
> + ;;
> --extra-ldflags=*)
> ;;
> --enable-debug-info)
> @@ -1304,6 +1312,7 @@ Advanced options (experts only):
> --cxx=CXX use C++ compiler CXX [$cxx]
> --objcc=OBJCC use Objective-C compiler OBJCC [$objcc]
> --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS
> + --extra-cxxflags=CXXFLAGS append extra CXX compiler flags QEMU_CXXFLAGS
> --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS
> --make=MAKE use specified make [$make]
> --install=INSTALL use specified install [$install]
> @@ -1489,37 +1498,6 @@ if test "$bogus_os" = "yes"; then
> error_exit "Unrecognized host OS $targetos"
> fi
>
> -# Check that the C++ compiler exists and works with the C compiler
> -if has $cxx; then
> - cat > $TMPC <<EOF
> -int c_function(void);
> -int main(void) { return c_function(); }
> -EOF
> -
> - compile_object
> -
> - cat > $TMPCXX <<EOF
> -extern "C" {
> - int c_function(void);
> -}
> -int c_function(void) { return 42; }
> -EOF
> -
> - update_cxxflags
> -
> - if do_cxx $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $LDFLAGS; then
> - # C++ compiler $cxx works ok with C compiler $cc
> - :
> - else
> - echo "C++ compiler $cxx does not work with C compiler $cc"
> - echo "Disabling C++ specific optional code"
> - cxx=
> - fi
> -else
> - echo "No C++ compiler available; disabling C++ specific optional code"
> - cxx=
> -fi
> -
> gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
> gcc_flags="-Wformat-security -Wformat-y2k -Winit-self
> -Wignored-qualifiers $gcc_flags"
> gcc_flags="-Wno-missing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
> @@ -5063,6 +5041,38 @@ EOF
> fi
> fi
>
> +# Check that the C++ compiler exists and works with the C compiler.
> +# All the QEMU_CXXFLAGS are based on QEMU_CFLAGS. Keep this at the
> end to don't miss any other that could be added.
> +if has $cxx; then
> + cat > $TMPC <<EOF
> +int c_function(void);
> +int main(void) { return c_function(); }
> +EOF
> +
> + compile_object
> +
> + cat > $TMPCXX <<EOF
> +extern "C" {
> + int c_function(void);
> +}
> +int c_function(void) { return 42; }
> +EOF
> +
> + update_cxxflags
> +
> + if do_cxx $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $LDFLAGS; then
> + # C++ compiler $cxx works ok with C compiler $cc
> + :
> + else
> + echo "C++ compiler $cxx does not work with C compiler $cc"
> + echo "Disabling C++ specific optional code"
> + cxx=
> + fi
> +else
> + echo "No C++ compiler available; disabling C++ specific optional code"
> + cxx=
> +fi
> +
> echo_version() {
> if test "$1" = "yes" ; then
> echo "($2)"
> @@ -5268,6 +5278,7 @@ if test "$mingw32" = "no" ; then
> fi
> echo "qemu_helperdir=$libexecdir" >> $config_host_mak
> echo "extra_cflags=$EXTRA_CFLAGS" >> $config_host_mak
> +echo "extra_cxxflags=$EXTRA_CXXFLAGS" >> $config_host_mak
> echo "extra_ldflags=$EXTRA_LDFLAGS" >> $config_host_mak
> echo "qemu_localedir=$qemu_localedir" >> $config_host_mak
> echo "libs_softmmu=$libs_softmmu" >> $config_host_mak
> @@ -5906,6 +5917,7 @@ echo "WINDRES=$windres" >> $config_host_mak
> echo "CFLAGS=$CFLAGS" >> $config_host_mak
> echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak
> echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
> +echo "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak
> echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
> if test "$sparse" = "yes" ; then
> echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak
> diff --git a/disas/libvixl/Makefile.objs b/disas/libvixl/Makefile.objs
> index bbe7695..dbf7def 100644
> --- a/disas/libvixl/Makefile.objs
> +++ b/disas/libvixl/Makefile.objs
> @@ -6,6 +6,6 @@ libvixl_OBJS = vixl/utils.o \
>
> # The -Wno-sign-compare is needed only for gcc 4.6, which complains about
> # some signed-unsigned equality comparisons which later gcc versions do not.
> -$(addprefix $(obj)/,$(libvixl_OBJS)): QEMU_CFLAGS :=
> -I$(SRC_PATH)/disas/libvixl $(QEMU_CFLAGS) -Wno-sign-compare
> +$(addprefix $(obj)/,$(libvixl_OBJS)): QEMU_CXXFLAGS :=
> -I$(SRC_PATH)/disas/libvixl $(QEMU_CXXFLAGS) -Wno-sign-compare
>
> common-obj-$(CONFIG_ARM_A64_DIS) += $(libvixl_OBJS)
> diff --git a/rules.mak b/rules.mak
> index 1c0eabb..2a2fb72 100644
> --- a/rules.mak
> +++ b/rules.mak
> @@ -20,9 +20,6 @@ MAKEFLAGS += -rR
> %.mak:
> clean-target:
>
> -# Flags for C++ compilation
> -QEMU_CXXFLAGS = -D__STDC_LIMIT_MACROS $(filter-out
> -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs
> -Wold-style-declaration -Wold-style-definition -Wredundant-decls,
> $(QEMU_CFLAGS))
> -
> # Flags for dependency generation
> QEMU_DGFLAGS += -MMD -MP -MT $@ -MF $(@D)/$(*F).d
>
>
> Bruno
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH] split c and cxx extra flags
2017-06-02 13:07 [Qemu-devel] [PATCH] split c and cxx extra flags Bruno Dominguez
2017-06-06 9:18 ` Bruno Dominguez
@ 2017-06-06 9:28 ` Stefan Hajnoczi
2017-06-06 9:45 ` Bruno Dominguez
1 sibling, 1 reply; 8+ messages in thread
From: Stefan Hajnoczi @ 2017-06-06 9:28 UTC (permalink / raw)
To: Bruno Dominguez; +Cc: qemu-devel, Peter Maydell
[-- Attachment #1: Type: text/plain, Size: 3091 bytes --]
On Fri, Jun 02, 2017 at 02:07:26PM +0100, Bruno Dominguez wrote:
> There was no possibility to add specific cxx flags using the configure
> file. So A new entrance has been created to support it.
>
> Duplication of information in configure and rules.mak. Taking
> QEMU_CFLAGS and add them to QEMU_CXXFLAGS, now the value of
> QEMU_CXXFLAGS is stored in config-host.mak, so there is no need for
> it.
>
> The makefile for libvixl was adding flags for QEMU_CXXFLAGS in
> QEMU_CFLAGS because of the addition in rules.mak. That was removed, so
> adding them where it should be.
>
> -----
> Signed-off-by: Bruno Dominguez <bru.dominguez@gmail.com>
> -----
Please follow the code submission guidelines:
http://wiki.qemu.org/Contribute/SubmitAPatch
* The commit message (email subject) should have a prefix describing
the affected component. Use "git log ./configure" for inspiration.
I suggest the following:
configure: split c and cxx extra flags
* Use git-format-patch(1) so that your patch applies cleanly. Your
email has:
----
Signed-off-by: ...
----
This is not the format recognized by tools. Instead the
Signed-off-by: should be part of the commit description (no '----')
and then a line with just three hyphens ('---') denotes the end of
the commit description:
Signed-off-by: ...
---
* The email must not be line-wrapped since that breaks the patch. If
you use git-send-email(1) to submit patches then this is taken care
of automatically.
> @@ -1304,6 +1312,7 @@ Advanced options (experts only):
> --cxx=CXX use C++ compiler CXX [$cxx]
> --objcc=OBJCC use Objective-C compiler OBJCC [$objcc]
> --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS
> + --extra-cxxflags=CXXFLAGS append extra CXX compiler flags QEMU_CXXFLAGS
For consistency with the --cxx= option description:
s/CXX compiler/C++ compiler/
> @@ -1489,37 +1498,6 @@ if test "$bogus_os" = "yes"; then
> error_exit "Unrecognized host OS $targetos"
> fi
>
> -# Check that the C++ compiler exists and works with the C compiler
> -if has $cxx; then
> - cat > $TMPC <<EOF
> -int c_function(void);
> -int main(void) { return c_function(); }
> -EOF
> -
> - compile_object
> -
> - cat > $TMPCXX <<EOF
> -extern "C" {
> - int c_function(void);
> -}
> -int c_function(void) { return 42; }
> -EOF
> -
> - update_cxxflags
> -
> - if do_cxx $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $LDFLAGS; then
> - # C++ compiler $cxx works ok with C compiler $cc
> - :
> - else
> - echo "C++ compiler $cxx does not work with C compiler $cc"
> - echo "Disabling C++ specific optional code"
> - cxx=
> - fi
> -else
> - echo "No C++ compiler available; disabling C++ specific optional code"
> - cxx=
> -fi
> -
Why move this code?
>
> Bruno
>
This signature will break tools that apply the patch. It's easiest to
use git-send-email(1) to avoid problems like this.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH] split c and cxx extra flags
2017-06-06 9:28 ` Stefan Hajnoczi
@ 2017-06-06 9:45 ` Bruno Dominguez
2017-06-06 10:38 ` Stefan Hajnoczi
0 siblings, 1 reply; 8+ messages in thread
From: Bruno Dominguez @ 2017-06-06 9:45 UTC (permalink / raw)
To: Stefan Hajnoczi; +Cc: qemu-devel, Peter Maydell
2017-06-06 10:28 GMT+01:00 Stefan Hajnoczi <stefanha@gmail.com>:
> On Fri, Jun 02, 2017 at 02:07:26PM +0100, Bruno Dominguez wrote:
>> There was no possibility to add specific cxx flags using the configure
>> file. So A new entrance has been created to support it.
>>
>> Duplication of information in configure and rules.mak. Taking
>> QEMU_CFLAGS and add them to QEMU_CXXFLAGS, now the value of
>> QEMU_CXXFLAGS is stored in config-host.mak, so there is no need for
>> it.
>>
>> The makefile for libvixl was adding flags for QEMU_CXXFLAGS in
>> QEMU_CFLAGS because of the addition in rules.mak. That was removed, so
>> adding them where it should be.
>>
>> -----
>> Signed-off-by: Bruno Dominguez <bru.dominguez@gmail.com>
>> -----
>
> Please follow the code submission guidelines:
> http://wiki.qemu.org/Contribute/SubmitAPatch
>
> * The commit message (email subject) should have a prefix describing
> the affected component. Use "git log ./configure" for inspiration.
> I suggest the following:
>
> configure: split c and cxx extra flags
>
> * Use git-format-patch(1) so that your patch applies cleanly. Your
> email has:
>
> ----
> Signed-off-by: ...
> ----
>
> This is not the format recognized by tools. Instead the
> Signed-off-by: should be part of the commit description (no '----')
> and then a line with just three hyphens ('---') denotes the end of
> the commit description:
>
> Signed-off-by: ...
> ---
>
> * The email must not be line-wrapped since that breaks the patch. If
> you use git-send-email(1) to submit patches then this is taken care
> of automatically.
>
ok, will give it another go.
>> @@ -1304,6 +1312,7 @@ Advanced options (experts only):
>> --cxx=CXX use C++ compiler CXX [$cxx]
>> --objcc=OBJCC use Objective-C compiler OBJCC [$objcc]
>> --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS
>> + --extra-cxxflags=CXXFLAGS append extra CXX compiler flags QEMU_CXXFLAGS
>
> For consistency with the --cxx= option description:
>
> s/CXX compiler/C++ compiler/
>
will do.
>> @@ -1489,37 +1498,6 @@ if test "$bogus_os" = "yes"; then
>> error_exit "Unrecognized host OS $targetos"
>> fi
>>
>> -# Check that the C++ compiler exists and works with the C compiler
>> -if has $cxx; then
>> - cat > $TMPC <<EOF
>> -int c_function(void);
>> -int main(void) { return c_function(); }
>> -EOF
>> -
>> - compile_object
>> -
>> - cat > $TMPCXX <<EOF
>> -extern "C" {
>> - int c_function(void);
>> -}
>> -int c_function(void) { return 42; }
>> -EOF
>> -
>> - update_cxxflags
>> -
>> - if do_cxx $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $LDFLAGS; then
>> - # C++ compiler $cxx works ok with C compiler $cc
>> - :
>> - else
>> - echo "C++ compiler $cxx does not work with C compiler $cc"
>> - echo "Disabling C++ specific optional code"
>> - cxx=
>> - fi
>> -else
>> - echo "No C++ compiler available; disabling C++ specific optional code"
>> - cxx=
>> -fi
>> -
>
> Why move this code?
>
the configure file adds "-fPIE -DPIE" to QEMU_CFLAGS around line 1570.
Where QEMU_CXXFLAGS is placed is not taken it, hence this flag is not
tested with the c++ compiler and breaks the build later on for not
existing. Because QEMU_CXXFLAGS was reassigned again in rules.mak this
was hidden.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH] split c and cxx extra flags
2017-06-06 9:45 ` Bruno Dominguez
@ 2017-06-06 10:38 ` Stefan Hajnoczi
2017-06-06 12:20 ` Bruno Dominguez
0 siblings, 1 reply; 8+ messages in thread
From: Stefan Hajnoczi @ 2017-06-06 10:38 UTC (permalink / raw)
To: Bruno Dominguez; +Cc: qemu-devel, Peter Maydell
On Tue, Jun 6, 2017 at 10:45 AM, Bruno Dominguez
<bru.dominguez@gmail.com> wrote:
> 2017-06-06 10:28 GMT+01:00 Stefan Hajnoczi <stefanha@gmail.com>:
>> On Fri, Jun 02, 2017 at 02:07:26PM +0100, Bruno Dominguez wrote:
>>> @@ -1489,37 +1498,6 @@ if test "$bogus_os" = "yes"; then
>>> error_exit "Unrecognized host OS $targetos"
>>> fi
>>>
>>> -# Check that the C++ compiler exists and works with the C compiler
>>> -if has $cxx; then
>>> - cat > $TMPC <<EOF
>>> -int c_function(void);
>>> -int main(void) { return c_function(); }
>>> -EOF
>>> -
>>> - compile_object
>>> -
>>> - cat > $TMPCXX <<EOF
>>> -extern "C" {
>>> - int c_function(void);
>>> -}
>>> -int c_function(void) { return 42; }
>>> -EOF
>>> -
>>> - update_cxxflags
>>> -
>>> - if do_cxx $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $LDFLAGS; then
>>> - # C++ compiler $cxx works ok with C compiler $cc
>>> - :
>>> - else
>>> - echo "C++ compiler $cxx does not work with C compiler $cc"
>>> - echo "Disabling C++ specific optional code"
>>> - cxx=
>>> - fi
>>> -else
>>> - echo "No C++ compiler available; disabling C++ specific optional code"
>>> - cxx=
>>> -fi
>>> -
>>
>> Why move this code?
>>
>
> the configure file adds "-fPIE -DPIE" to QEMU_CFLAGS around line 1570.
> Where QEMU_CXXFLAGS is placed is not taken it, hence this flag is not
> tested with the c++ compiler and breaks the build later on for not
> existing. Because QEMU_CXXFLAGS was reassigned again in rules.mak this
> was hidden.
Thanks for explaining.
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH] split c and cxx extra flags
2017-06-06 10:38 ` Stefan Hajnoczi
@ 2017-06-06 12:20 ` Bruno Dominguez
2017-06-06 12:38 ` Stefan Hajnoczi
0 siblings, 1 reply; 8+ messages in thread
From: Bruno Dominguez @ 2017-06-06 12:20 UTC (permalink / raw)
To: Stefan Hajnoczi; +Cc: qemu-devel, Peter Maydell
sending again the patch with the correct format and:
1. Matching --extra-cxxflags description with --cxx
2. Removing some extra spaces indicated by checkpatch script.
Signed-off-by: Bruno Dominguez <bru.dominguez@gmail.com>
---
configure | 74 +++++++++++++++++++++++++--------------------
disas/libvixl/Makefile.objs | 2 +-
rules.mak | 3 --
3 files changed, 43 insertions(+), 36 deletions(-)
diff --git a/configure b/configure
index 0586ec9..4ab0d0f 100755
--- a/configure
+++ b/configure
@@ -91,7 +91,8 @@ update_cxxflags() {
# Set QEMU_CXXFLAGS from QEMU_CFLAGS by filtering out those
# options which some versions of GCC's C++ compiler complain about
# because they only make sense for C programs.
- QEMU_CXXFLAGS=
+ QEMU_CXXFLAGS="$QEMU_CXXFLAGS -D__STDC_LIMIT_MACROS"
+
for arg in $QEMU_CFLAGS; do
case $arg in
-Wstrict-prototypes|-Wmissing-prototypes|-Wnested-externs|\
@@ -344,6 +345,9 @@ for opt do
--extra-cflags=*) QEMU_CFLAGS="$QEMU_CFLAGS $optarg"
EXTRA_CFLAGS="$optarg"
;;
+ --extra-cxxflags=*) QEMU_CXXFLAGS="$QEMU_CXXFLAGS $optarg"
+ EXTRA_CXXFLAGS="$optarg"
+ ;;
--extra-ldflags=*) LDFLAGS="$LDFLAGS $optarg"
EXTRA_LDFLAGS="$optarg"
;;
@@ -787,6 +791,8 @@ for opt do
;;
--extra-cflags=*)
;;
+ --extra-cxxflags=*)
+ ;;
--extra-ldflags=*)
;;
--enable-debug-info)
@@ -1304,6 +1310,7 @@ Advanced options (experts only):
--cxx=CXX use C++ compiler CXX [$cxx]
--objcc=OBJCC use Objective-C compiler OBJCC [$objcc]
--extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS
+ --extra-cxxflags=CXXFLAGS append extra C++ compiler flags QEMU_CXXFLAGS
--extra-ldflags=LDFLAGS append extra linker flags LDFLAGS
--make=MAKE use specified make [$make]
--install=INSTALL use specified install [$install]
@@ -1489,37 +1496,6 @@ if test "$bogus_os" = "yes"; then
error_exit "Unrecognized host OS $targetos"
fi
-# Check that the C++ compiler exists and works with the C compiler
-if has $cxx; then
- cat > $TMPC <<EOF
-int c_function(void);
-int main(void) { return c_function(); }
-EOF
-
- compile_object
-
- cat > $TMPCXX <<EOF
-extern "C" {
- int c_function(void);
-}
-int c_function(void) { return 42; }
-EOF
-
- update_cxxflags
-
- if do_cxx $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $LDFLAGS; then
- # C++ compiler $cxx works ok with C compiler $cc
- :
- else
- echo "C++ compiler $cxx does not work with C compiler $cc"
- echo "Disabling C++ specific optional code"
- cxx=
- fi
-else
- echo "No C++ compiler available; disabling C++ specific optional code"
- cxx=
-fi
-
gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
gcc_flags="-Wformat-security -Wformat-y2k -Winit-self
-Wignored-qualifiers $gcc_flags"
gcc_flags="-Wno-missing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
@@ -5063,6 +5039,38 @@ EOF
fi
fi
+# Check that the C++ compiler exists and works with the C compiler.
+# All the QEMU_CXXFLAGS are based on QEMU_CFLAGS. Keep this at the
end to don't miss any other that could be added.
+if has $cxx; then
+ cat > $TMPC <<EOF
+int c_function(void);
+int main(void) { return c_function(); }
+EOF
+
+ compile_object
+
+ cat > $TMPCXX <<EOF
+extern "C" {
+ int c_function(void);
+}
+int c_function(void) { return 42; }
+EOF
+
+ update_cxxflags
+
+ if do_cxx $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $LDFLAGS; then
+ # C++ compiler $cxx works ok with C compiler $cc
+ :
+ else
+ echo "C++ compiler $cxx does not work with C compiler $cc"
+ echo "Disabling C++ specific optional code"
+ cxx=
+ fi
+else
+ echo "No C++ compiler available; disabling C++ specific optional code"
+ cxx=
+fi
+
echo_version() {
if test "$1" = "yes" ; then
echo "($2)"
@@ -5268,6 +5276,7 @@ if test "$mingw32" = "no" ; then
fi
echo "qemu_helperdir=$libexecdir" >> $config_host_mak
echo "extra_cflags=$EXTRA_CFLAGS" >> $config_host_mak
+echo "extra_cxxflags=$EXTRA_CXXFLAGS" >> $config_host_mak
echo "extra_ldflags=$EXTRA_LDFLAGS" >> $config_host_mak
echo "qemu_localedir=$qemu_localedir" >> $config_host_mak
echo "libs_softmmu=$libs_softmmu" >> $config_host_mak
@@ -5906,6 +5915,7 @@ echo "WINDRES=$windres" >> $config_host_mak
echo "CFLAGS=$CFLAGS" >> $config_host_mak
echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak
echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
+echo "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak
echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
if test "$sparse" = "yes" ; then
echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak
diff --git a/disas/libvixl/Makefile.objs b/disas/libvixl/Makefile.objs
index bbe7695..dbf7def 100644
--- a/disas/libvixl/Makefile.objs
+++ b/disas/libvixl/Makefile.objs
@@ -6,6 +6,6 @@ libvixl_OBJS = vixl/utils.o \
# The -Wno-sign-compare is needed only for gcc 4.6, which complains about
# some signed-unsigned equality comparisons which later gcc versions do not.
-$(addprefix $(obj)/,$(libvixl_OBJS)): QEMU_CFLAGS :=
-I$(SRC_PATH)/disas/libvixl $(QEMU_CFLAGS) -Wno-sign-compare
+$(addprefix $(obj)/,$(libvixl_OBJS)): QEMU_CXXFLAGS :=
-I$(SRC_PATH)/disas/libvixl $(QEMU_CXXFLAGS) -Wno-sign-compare
common-obj-$(CONFIG_ARM_A64_DIS) += $(libvixl_OBJS)
diff --git a/rules.mak b/rules.mak
index 1c0eabb..2a2fb72 100644
--- a/rules.mak
+++ b/rules.mak
@@ -20,9 +20,6 @@ MAKEFLAGS += -rR
%.mak:
clean-target:
-# Flags for C++ compilation
-QEMU_CXXFLAGS = -D__STDC_LIMIT_MACROS $(filter-out
-Wstrict-prototypes -Wmissing-prototypes -Wnested-externs
-Wold-style-declaration -Wold-style-definition -Wredundant-decls,
$(QEMU_CFLAGS))
-
# Flags for dependency generation
QEMU_DGFLAGS += -MMD -MP -MT $@ -MF $(@D)/$(*F).d
--
1.9.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH] split c and cxx extra flags
2017-06-06 12:20 ` Bruno Dominguez
@ 2017-06-06 12:38 ` Stefan Hajnoczi
2017-06-06 12:59 ` Bruno Dominguez
0 siblings, 1 reply; 8+ messages in thread
From: Stefan Hajnoczi @ 2017-06-06 12:38 UTC (permalink / raw)
To: Bruno Dominguez; +Cc: qemu-devel, Peter Maydell
On Tue, Jun 6, 2017 at 1:20 PM, Bruno Dominguez <bru.dominguez@gmail.com> wrote:
> sending again the patch with the correct format and:
>
> 1. Matching --extra-cxxflags description with --cxx
> 2. Removing some extra spaces indicated by checkpatch script.
The code looks fine to me:
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
A few more points about patch submission:
All email body text above '---' is the commit description that is
included in the git log. Therefore the commit description should only
contain information that is useful in the version history, like the
rationale for this commit.
Please put changelog information below '---' so it does not become
part of the git log. Once the patch has been merged it's not useful
to know that you're "sending again the patch with the correct format
and:" and so on.
The submission guidelines page says "send each new revision as a new
top-level thread, rather than burying it in-reply-to an earlier
revision, as many reviewers are not looking inside deep threads for
new patches".
There are tools that make it easy to send and manage patch series.
That way you don't have to invoke git-format-patch/git-send-email and
perform manual steps. The tool I use is git-publish:
https://github.com/stefanha/git-publish
Putting this all together, please send a new top-level email like this:
Subject: [PATCH v2] configure: split c and cxx extra flags
There was no possibility to add specific cxx flags using the configure
file. So A new entrance has been created to support it.
Duplication of information in configure and rules.mak. Taking
QEMU_CFLAGS and add them to QEMU_CXXFLAGS, now the value of
QEMU_CXXFLAGS is stored in config-host.mak, so there is no need for
it.
The makefile for libvixl was adding flags for QEMU_CXXFLAGS in
QEMU_CFLAGS because of the addition in rules.mak. That was removed, so
adding them where it should be.
Signed-off-by: Bruno Dominguez <bru.dominguez@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
---
v2:
* Matching --extra-cxxflags description with --cxx
* Removing some extra spaces indicated by checkpatch script
* Fixed patch format
...
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH] split c and cxx extra flags
2017-06-06 12:38 ` Stefan Hajnoczi
@ 2017-06-06 12:59 ` Bruno Dominguez
0 siblings, 0 replies; 8+ messages in thread
From: Bruno Dominguez @ 2017-06-06 12:59 UTC (permalink / raw)
To: Stefan Hajnoczi; +Cc: qemu-devel, Peter Maydell
ok, thanks for the clarification.
2017-06-06 13:38 GMT+01:00 Stefan Hajnoczi <stefanha@gmail.com>:
> On Tue, Jun 6, 2017 at 1:20 PM, Bruno Dominguez <bru.dominguez@gmail.com> wrote:
>> sending again the patch with the correct format and:
>>
>> 1. Matching --extra-cxxflags description with --cxx
>> 2. Removing some extra spaces indicated by checkpatch script.
>
> The code looks fine to me:
> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
>
> A few more points about patch submission:
>
> All email body text above '---' is the commit description that is
> included in the git log. Therefore the commit description should only
> contain information that is useful in the version history, like the
> rationale for this commit.
>
> Please put changelog information below '---' so it does not become
> part of the git log. Once the patch has been merged it's not useful
> to know that you're "sending again the patch with the correct format
> and:" and so on.
>
> The submission guidelines page says "send each new revision as a new
> top-level thread, rather than burying it in-reply-to an earlier
> revision, as many reviewers are not looking inside deep threads for
> new patches".
>
> There are tools that make it easy to send and manage patch series.
> That way you don't have to invoke git-format-patch/git-send-email and
> perform manual steps. The tool I use is git-publish:
> https://github.com/stefanha/git-publish
>
> Putting this all together, please send a new top-level email like this:
>
> Subject: [PATCH v2] configure: split c and cxx extra flags
>
> There was no possibility to add specific cxx flags using the configure
> file. So A new entrance has been created to support it.
>
> Duplication of information in configure and rules.mak. Taking
> QEMU_CFLAGS and add them to QEMU_CXXFLAGS, now the value of
> QEMU_CXXFLAGS is stored in config-host.mak, so there is no need for
> it.
>
> The makefile for libvixl was adding flags for QEMU_CXXFLAGS in
> QEMU_CFLAGS because of the addition in rules.mak. That was removed, so
> adding them where it should be.
>
> Signed-off-by: Bruno Dominguez <bru.dominguez@gmail.com>
> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
> v2:
> * Matching --extra-cxxflags description with --cxx
> * Removing some extra spaces indicated by checkpatch script
> * Fixed patch format
>
> ...
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2017-06-06 12:59 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-02 13:07 [Qemu-devel] [PATCH] split c and cxx extra flags Bruno Dominguez
2017-06-06 9:18 ` Bruno Dominguez
2017-06-06 9:28 ` Stefan Hajnoczi
2017-06-06 9:45 ` Bruno Dominguez
2017-06-06 10:38 ` Stefan Hajnoczi
2017-06-06 12:20 ` Bruno Dominguez
2017-06-06 12:38 ` Stefan Hajnoczi
2017-06-06 12:59 ` Bruno Dominguez
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).