Updated Branches: refs/heads/master 73aa3ea29 -> 5dc5b8bb4
Migrate more compiler flag probing to Charmonizer. When possible, move probing for compiler flags which are used on core source files out of the Perl build and into Charmonizer so that the probing logic can be reused across other host builds. Sometimes flags need to be duplicated rather than migrated -- for instance, the "/TP" to make MSVC compile as C++ is still mandatory because of our headers (though not because of the source content that goes into $module.xs). Project: http://git-wip-us.apache.org/repos/asf/lucy/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/b6e98efc Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/b6e98efc Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/b6e98efc Branch: refs/heads/master Commit: b6e98efcbb2fe41c7bd1012abcc74e86f3a8f6ac Parents: a267c20 Author: Marvin Humphrey <[email protected]> Authored: Thu Dec 13 18:16:41 2012 -0800 Committer: Marvin Humphrey <[email protected]> Committed: Wed Jan 2 12:10:12 2013 -0800 ---------------------------------------------------------------------- .../compiler/perl/lib/Clownfish/CFC/Perl/Build.pm | 5 +--- .../perl/lib/Clownfish/CFC/Perl/Build/Charmonic.pm | 5 +--- clownfish/runtime/common/charmonizer.c | 15 ++++++++++++++ clownfish/runtime/common/charmonizer.main | 15 ++++++++++++++ common/charmonizer.c | 16 ++++++++++++++- common/charmonizer.main | 16 ++++++++++++++- 6 files changed, 62 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy/blob/b6e98efc/clownfish/compiler/perl/lib/Clownfish/CFC/Perl/Build.pm ---------------------------------------------------------------------- diff --git a/clownfish/compiler/perl/lib/Clownfish/CFC/Perl/Build.pm b/clownfish/compiler/perl/lib/Clownfish/CFC/Perl/Build.pm index 7f21b39..19ada50 100644 --- a/clownfish/compiler/perl/lib/Clownfish/CFC/Perl/Build.pm +++ b/clownfish/compiler/perl/lib/Clownfish/CFC/Perl/Build.pm @@ -59,10 +59,7 @@ sub new { my $self = shift->SUPER::new( @_ ); my $extra_ccflags = $self->extra_compiler_flags; - if ( $self->config('gccversion') ) { - push @$extra_ccflags, qw( -std=gnu99 -D_GNU_SOURCE ); - } - elsif ( $self->config('cc') =~ /^cl\b/ ) { + if ( $self->config('cc') =~ /^cl\b/ ) { # Compile as C++ under MSVC. push @$extra_ccflags, qw( -TP -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS http://git-wip-us.apache.org/repos/asf/lucy/blob/b6e98efc/clownfish/compiler/perl/lib/Clownfish/CFC/Perl/Build/Charmonic.pm ---------------------------------------------------------------------- diff --git a/clownfish/compiler/perl/lib/Clownfish/CFC/Perl/Build/Charmonic.pm b/clownfish/compiler/perl/lib/Clownfish/CFC/Perl/Build/Charmonic.pm index d35b1e6..8c5843c 100644 --- a/clownfish/compiler/perl/lib/Clownfish/CFC/Perl/Build/Charmonic.pm +++ b/clownfish/compiler/perl/lib/Clownfish/CFC/Perl/Build/Charmonic.pm @@ -79,10 +79,7 @@ sub ACTION_charmony { if ( !$self->config('usethreads') ) { push @command, '--disable-threads'; } - push @command, - '--', - $self->config('ccflags'), - map { _quotify($_) } @{ $self->extra_compiler_flags }; + push @command, ( '--', $self->config('ccflags') ); if ( $ENV{CHARM_VALGRIND} ) { unshift @command, "valgrind", "--leak-check=yes"; } http://git-wip-us.apache.org/repos/asf/lucy/blob/b6e98efc/clownfish/runtime/common/charmonizer.c ---------------------------------------------------------------------- diff --git a/clownfish/runtime/common/charmonizer.c b/clownfish/runtime/common/charmonizer.c index b9659f8..2426098 100644 --- a/clownfish/runtime/common/charmonizer.c +++ b/clownfish/runtime/common/charmonizer.c @@ -4881,6 +4881,21 @@ S_add_compiler_flags(struct chaz_CLIArgs *args) { "-Wno-variadic-macros " ); } + + /* Only core source files require this -- not our headers and + * autogenerated files. */ + chaz_CC_add_extra_cflags("-std=gnu99 -D_GNU_SOURCE"); + } + else if (chaz_Probe_compiler_is_msvc()) { + /* Compile as C++ under MSVC. */ + chaz_CC_add_extra_cflags("/TP"); + + /* Thwart stupid warnings. */ + chaz_CC_add_extra_cflags("-D_CRT_SECURE_NO_WARNINGS"); + chaz_CC_add_extra_cflags("-D_SCL_SECURE_NO_WARNINGS"); + + /* Redefine 'for' to fix broken 'for' scoping under MSVC6. */ + chaz_CC_add_extra_cflags("-Dfor=\"if(0);else for\""); } } http://git-wip-us.apache.org/repos/asf/lucy/blob/b6e98efc/clownfish/runtime/common/charmonizer.main ---------------------------------------------------------------------- diff --git a/clownfish/runtime/common/charmonizer.main b/clownfish/runtime/common/charmonizer.main index 4ffef3b..56c83a0 100644 --- a/clownfish/runtime/common/charmonizer.main +++ b/clownfish/runtime/common/charmonizer.main @@ -51,6 +51,21 @@ S_add_compiler_flags(struct chaz_CLIArgs *args) { "-Wno-variadic-macros " ); } + + /* Only core source files require this -- not our headers and + * autogenerated files. */ + chaz_CC_add_extra_cflags("-std=gnu99 -D_GNU_SOURCE"); + } + else if (chaz_Probe_compiler_is_msvc()) { + /* Compile as C++ under MSVC. */ + chaz_CC_add_extra_cflags("/TP"); + + /* Thwart stupid warnings. */ + chaz_CC_add_extra_cflags("-D_CRT_SECURE_NO_WARNINGS"); + chaz_CC_add_extra_cflags("-D_SCL_SECURE_NO_WARNINGS"); + + /* Redefine 'for' to fix broken 'for' scoping under MSVC6. */ + chaz_CC_add_extra_cflags("-Dfor=\"if(0);else for\""); } } http://git-wip-us.apache.org/repos/asf/lucy/blob/b6e98efc/common/charmonizer.c ---------------------------------------------------------------------- diff --git a/common/charmonizer.c b/common/charmonizer.c index 24ff672..ca984d3 100644 --- a/common/charmonizer.c +++ b/common/charmonizer.c @@ -4880,6 +4880,21 @@ S_add_compiler_flags(struct chaz_CLIArgs *args) { "-Wno-variadic-macros " ); } + + /* Only core source files require this -- not our headers and + * autogenerated files. */ + chaz_CC_add_extra_cflags("-std=gnu99 -D_GNU_SOURCE"); + } + else if (chaz_Probe_compiler_is_msvc()) { + /* Compile as C++ under MSVC. */ + chaz_CC_add_extra_cflags("/TP"); + + /* Thwart stupid warnings. */ + chaz_CC_add_extra_cflags("-D_CRT_SECURE_NO_WARNINGS"); + chaz_CC_add_extra_cflags("-D_SCL_SECURE_NO_WARNINGS"); + + /* Redefine 'for' to fix broken 'for' scoping under MSVC6. */ + chaz_CC_add_extra_cflags("-Dfor=\"if(0);else for\""); } } @@ -4893,7 +4908,6 @@ int main(int argc, const char **argv) { } chaz_Probe_init(&args); S_add_compiler_flags(&args); - } { int i; http://git-wip-us.apache.org/repos/asf/lucy/blob/b6e98efc/common/charmonizer.main ---------------------------------------------------------------------- diff --git a/common/charmonizer.main b/common/charmonizer.main index 0a54b88..c8a6d24 100644 --- a/common/charmonizer.main +++ b/common/charmonizer.main @@ -50,6 +50,21 @@ S_add_compiler_flags(struct chaz_CLIArgs *args) { "-Wno-variadic-macros " ); } + + /* Only core source files require this -- not our headers and + * autogenerated files. */ + chaz_CC_add_extra_cflags("-std=gnu99 -D_GNU_SOURCE"); + } + else if (chaz_Probe_compiler_is_msvc()) { + /* Compile as C++ under MSVC. */ + chaz_CC_add_extra_cflags("/TP"); + + /* Thwart stupid warnings. */ + chaz_CC_add_extra_cflags("-D_CRT_SECURE_NO_WARNINGS"); + chaz_CC_add_extra_cflags("-D_SCL_SECURE_NO_WARNINGS"); + + /* Redefine 'for' to fix broken 'for' scoping under MSVC6. */ + chaz_CC_add_extra_cflags("-Dfor=\"if(0);else for\""); } } @@ -63,7 +78,6 @@ int main(int argc, const char **argv) { } chaz_Probe_init(&args); S_add_compiler_flags(&args); - } { int i;
