From 4287d1e348027303eca96efe3a3a17ce107e0977 Mon Sep 17 00:00:00 2001 From: mquinson Date: Sun, 23 Oct 2005 12:50:33 +0000 Subject: [PATCH] Try to explain gcc that we're rewriting the source file, and that it must report errors against another file (not very robust, but works if you have only one #ifdef SIMGRID_TEST chunk per file) git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@1813 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- tools/sg_unit_extractor.pl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/sg_unit_extractor.pl b/tools/sg_unit_extractor.pl index e7d14228fe..2a93c8dc93 100755 --- a/tools/sg_unit_extractor.pl +++ b/tools/sg_unit_extractor.pl @@ -22,8 +22,12 @@ my (@tests); # actual content open IN, "$infile" || die "$progname: Cannot open input file '$infile': $!\n"; my $takeit=0; +my $line=0; +my $beginline=0; while () { + $line++; if (m/ifdef +SIMGRID_TEST/) { + $beginline = $line; $takeit = 1; next; } @@ -67,11 +71,12 @@ die "$progname: no suite defined in $infile\n" my ($GENERATED)=("/*******************************/\n". "/* GENERATED FILE, DO NOT EDIT */\n". "/*******************************/\n\n"); - +$beginline+=2; open OUT,">$outfile" || die "$progname: Cannot open output file '$outfile': $!\n"; print OUT $GENERATED; print OUT "#include \"xbt.h\"\n"; print OUT $GENERATED; +print OUT "# $beginline \"$infile\" \n"; print OUT "$unit_source"; print OUT $GENERATED; close OUT || die "$progname: Cannot close output file '$outfile': $!\n"; @@ -81,6 +86,7 @@ if (! -e "simgrid_units_main.c") { open OUT,">simgrid_units_main.c" || die "$progname: Cannot open main file 'simgrid_units_main.c': $!\n"; print OUT $GENERATED; print OUT "#include \"xbt.h\"\n\n"; + print OUT "extern xbt_test_unit_t _xbt_current_unit;\n\n"; print OUT "/* SGU: BEGIN PROTOTYPES */\n"; print OUT "/* SGU: END PROTOTYPES */\n\n"; print OUT $GENERATED; @@ -131,7 +137,7 @@ open IN,"simgrid_units_main.c" || die "$progname: Cannot open main file 'simgrid $newmain .= " /* SGU: BEGIN FILE $infile */\n"; map { my ($name,$func,$title) = @{$_}; - $newmain .= " void $func(xbt_test_unit_t _unit);\n" + $newmain .= " void $func(void);\n" } @tests; $newmain .= " /* SGU: END FILE */\n\n"; -- 2.20.1