Commit 61ee8e26 authored by Jacob Champion's avatar Jacob Champion
Browse files

httpdunit_gen_cases: separate declarations from calls

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
parent f049f810
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -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

+13 −2
Original line number Diff line number Diff line
@@ -14,10 +14,21 @@
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); ";

        if ($print_declaration) {
            print "TCase *$name(void);\n";
        } else {
            print "suite_add_tcase(suite, $name());\n";
        }
    }
}