]> granicus.if.org Git - apache/commitdiff
httpdunit_gen_cases: separate declarations from calls
authorJacob Champion <jchampion@apache.org>
Thu, 25 May 2017 21:18:33 +0000 (21:18 +0000)
committerJacob Champion <jchampion@apache.org>
Thu, 25 May 2017 21:18:33 +0000 (21:18 +0000)
This gets around strict compiler warnings.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/httpdunit@1796203 13f79535-47bb-0310-9956-ffa450edef68

Makefile.in
build/httpdunit_gen_cases.pl

index f6fac281321d3554e228b4afb007eff975f2b9e7..9bba3ac0803aeba0b93d1a9f729e2226d92ae8cf 100644 (file)
@@ -456,8 +456,11 @@ $(testcase_STUBS): %.tests: %.c
 
 test/httpdunit.cases: $(testcase_SOURCES) | unittest-objdir
        for t in $^; do \
-           $(top_srcdir)/build/httpdunit_gen_cases.pl < "$$t"; \
+           $(top_srcdir)/build/httpdunit_gen_cases.pl --declaration < "$$t"; \
        done > $@
+       for t in $^; do \
+           $(top_srcdir)/build/httpdunit_gen_cases.pl < "$$t"; \
+       done >> $@
 
 test/httpdunit.lo: test/httpdunit.c test/httpdunit.cases | unittest-objdir
 
index a40d12c773d28b241c594ca42403b3fe62268db8..8e492a664df49f99153cd0167ad7f394100c2bbb 100755 (executable)
 use strict;
 use warnings;
 
+use Getopt::Long;
+
+my $print_declaration = 0;
+
+GetOptions("declaration" => \$print_declaration)
+    or die("unknown option");
+
 while (my $line = <>) {
     if ($line =~ /^HTTPD_BEGIN_TEST_CASE(?:\w+)?\((\w+)/) {
         my $name = "$1_test_case";
-        print "TCase *$name(void); ";
-        print "suite_add_tcase(suite, $name());\n";
+
+        if ($print_declaration) {
+            print "TCase *$name(void);\n";
+        } else {
+            print "suite_add_tcase(suite, $name());\n";
+        }
     }
 }