Mailing List Archive

svn commit: r440811 - in /spamassassin/trunk: MANIFEST spamc/configure spamc/configure.in t/cpp_comments_in_spamc.t
Author: jm
Date: Wed Sep 6 11:00:53 2006
New Revision: 440811

URL: http://svn.apache.org/viewvc?view=rev&rev=440811
Log:
bug 4768: be aggressive about keeping C++-style // comments out of libspamc, and use paranoid -Wflags if gcc is in use

Added:
spamassassin/trunk/t/cpp_comments_in_spamc.t (with props)
Modified:
spamassassin/trunk/MANIFEST
spamassassin/trunk/spamc/configure
spamassassin/trunk/spamc/configure.in

Modified: spamassassin/trunk/MANIFEST
URL: http://svn.apache.org/viewvc/spamassassin/trunk/MANIFEST?view=diff&rev=440811&r1=440810&r2=440811
==============================================================================
--- spamassassin/trunk/MANIFEST (original)
+++ spamassassin/trunk/MANIFEST Wed Sep 6 11:00:53 2006
@@ -268,6 +268,7 @@
t/cidrs.t
t/config.dist
t/config_errs.t
+t/cpp_comments_in_spamc.t
t/data/01_test_rules.cf
t/data/etc/hello.txt
t/data/etc/testhost.cert

Modified: spamassassin/trunk/spamc/configure
URL: http://svn.apache.org/viewvc/spamassassin/trunk/spamc/configure?view=diff&rev=440811&r1=440810&r2=440811
==============================================================================
--- spamassassin/trunk/spamc/configure (original)
+++ spamassassin/trunk/spamc/configure Wed Sep 6 11:00:53 2006
@@ -2232,7 +2232,7 @@


if test "x$GCC" = "xyes" ; then
- CFLAGS="-Wall $CFLAGS"
+ CFLAGS="-Wall -Wextra -Wdeclaration-after-statement $CFLAGS"
fi



Modified: spamassassin/trunk/spamc/configure.in
URL: http://svn.apache.org/viewvc/spamassassin/trunk/spamc/configure.in?view=diff&rev=440811&r1=440810&r2=440811
==============================================================================
--- spamassassin/trunk/spamc/configure.in (original)
+++ spamassassin/trunk/spamc/configure.in Wed Sep 6 11:00:53 2006
@@ -18,7 +18,7 @@
AC_PROG_CC

if test "x$GCC" = "xyes" ; then
- CFLAGS="-Wall $CFLAGS"
+ CFLAGS="-Wall -Wextra -Wdeclaration-after-statement $CFLAGS"
fi

AC_EXEEXT

Added: spamassassin/trunk/t/cpp_comments_in_spamc.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/cpp_comments_in_spamc.t?view=auto&rev=440811
==============================================================================
--- spamassassin/trunk/t/cpp_comments_in_spamc.t (added)
+++ spamassassin/trunk/t/cpp_comments_in_spamc.t Wed Sep 6 11:00:53 2006
@@ -0,0 +1,25 @@
+#!/usr/bin/perl
+
+use lib '.'; use lib 't';
+use SATest; sa_t_init("cpp_comments_in_spamc");
+use Test; BEGIN { plan tests => 1 };
+
+# ---------------------------------------------------------------------------
+# by simply reading the files directly in perl, we avoid all sorts
+# of C-compilation portability issues...
+
+my $ok = 1;
+foreach my $f (<../spamc/*.c>, <../spamc/*.h>) {
+ open (IN, "<$f");
+ my $str = join('', <IN>);
+ close IN;
+
+ $str =~ s{/\*.*?\*/}{}gs; # remove C comments
+ $str =~ s{".*?"}{}gs; # quoted strings
+
+ if ($str =~ m{(.{0,99}//.{0,99})}s) {
+ warn "found C-style comment: '$1'";
+ }
+}
+
+ok ($ok);

Propchange: spamassassin/trunk/t/cpp_comments_in_spamc.t
------------------------------------------------------------------------------
svn:executable = *