Permalink
Browse files

[GH #844] fix clang++ attributes, set -x c++ in cc

clang++ prints always a warning on c sources.
Move -x c++ from warnings upfront to cc, probed in auto::gcc
to be able to correctly probe for warnings and attributes.
This fixed almost all clang++ warnings, only dynoplibs
-Wno-parentheses-equality is missing for those.
  • Loading branch information...
1 parent 5b1e564 commit 1a2f59bf151c8d8f17fe09691ef71fdf515f78c4 @rurban rurban committed Sep 26, 2012
Showing with 10 additions and 6 deletions.
  1. +2 −2 config/auto/attributes.pm
  2. +8 −2 config/auto/gcc.pm
  3. +0 −2 config/auto/warnings.pm
@@ -1,4 +1,4 @@
-# Copyright (C) 2007-2010, Parrot Foundation.
+# Copyright (C) 2007-2012, Parrot Foundation.
=head1 NAME
@@ -63,7 +63,7 @@ sub try_attr {
$conf->debug("trying attribute '$attr'\n");
- my $cc = $conf->option_or_data('cc');
+ my $cc = $conf->data->get('cc');
$conf->cc_gen('config/auto/attributes/test_c.in');
my $disable_warnings = '';
View
@@ -1,4 +1,4 @@
-# Copyright (C) 2001-2007, Parrot Foundation.
+# Copyright (C) 2001-2012, Parrot Foundation.
=head1 NAME
@@ -88,11 +88,17 @@ sub _evaluate_gcc {
$conf->data->set( noinline => '__attribute__ ((noinline))' );
# sneaky check for g++
- my $gpp = (index($conf->data->get('cc'), '++') > 0) ? 1 : 0;
+ my $cc = $conf->data->get('cc');
+ my $gpp = (index($cc, '++') > 0) ? 1 : 0;
# even sneakier check for clang
my $clang = $conf->data->get('cc') =~ /clang/ ? 1 : 0;
+ # and set -x c++ for clang++
+ if ($clang and $gpp and index($cc, '-x c++') < 1) {
+ $conf->data->set('cc' => $cc.' -x c++');
+ }
+
$conf->data->set(
gccversion => $gccversion,
'g++' => $gpp,
@@ -325,8 +325,6 @@ sub runstep {
'-fvisibility=hidden';
};
if ($conf->data->get('clang') and $compiler eq 'g++') { # clang++
- unshift @{$self->{'warnings'}{$compiler}{'basic'}},
- '-x c++';
$self->{'warnings'}{$compiler}{'override'} = {
'-Wno-parentheses-equality' => [ qw(
src/ops/core_ops.c

0 comments on commit 1a2f59b

Please sign in to comment.