diff options
Diffstat (limited to 'tools/pidl/lib/Parse/Pidl/IDL.pm')
-rw-r--r-- | tools/pidl/lib/Parse/Pidl/IDL.pm | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/tools/pidl/lib/Parse/Pidl/IDL.pm b/tools/pidl/lib/Parse/Pidl/IDL.pm index 6927c892..46f9813c 100644 --- a/tools/pidl/lib/Parse/Pidl/IDL.pm +++ b/tools/pidl/lib/Parse/Pidl/IDL.pm @@ -10,6 +10,7 @@ package Parse::Pidl::IDL; use vars qw ( @ISA ); use strict; +use warnings; @ISA= qw ( Parse::Yapp::Driver ); use Parse::Yapp::Driver; @@ -2646,12 +2647,29 @@ sub parse_file($$) undef $/; my $cpp = $ENV{CPP}; my $options = ""; - if (! defined $cpp) { - if (defined $ENV{CC}) { - $cpp = "$ENV{CC}"; - $options = "-E"; - } else { - $cpp = "cpp"; + if ($^O eq "MSWin32") { + $cpp = "cpp"; + }else{ + if (! defined $cpp) { + if (defined $ENV{CC}) { + $cpp = "$ENV{CC}"; + $options = "-E"; + } else { + # + # If cc is Clang-based don't use cpp, as + # at least some versions of Clang, cpp + # doesn't strip // comments, but cc -E + # does. + # + + my $cc_version = `cc --version`; + if ($cc_version =~ /clang/) { + $cpp = "cc"; + $options = "-E" + } else { + $cpp = "cpp"; + } + } } } my $includes = join('',map { " -I$_" } @$incdirs); |