# Guard #warnings with #ifdef __GNUC__

# Usage:
#  files=`wcgrep -r -l '#warning' | grep -v '\.pov$'`
#  test -n "$files" && perl -pi guard_warnings.pl `echo $files`
#
# Author: David Faure
if (/^\s*#warning/) {
  if (not defined $lastline or $lastline !~ /#ifdef\s*__GNUC__\s*\n$/ ) {
    $_ = "#ifdef __GNUC__\n" . $_ . "#endif\n";
  }
}
# Common mistake
s/#ifdef __GNUC_\s*$/#ifdef __GNUC__/;
# Let's just use the same everywhere
s/#if defined\(\s*Q_CC_GNU\s*\)/#ifdef __GNUC__/;
$lastline=$_;
