3 # Copyright (c) 2011, 2014. The SimGrid Team.
6 # This program is free software; you can redistribute it and/or modify it
7 # under the terms of the license (GNU LGPL) which comes with this package.
9 # Add include for mandatory header file
10 print "#include <smpi_cocci.h>\n";
12 # FIXME: here we make the assumption that people don't do things like put
13 # multiple statements on the same line after a declaration, but separated by
14 # semicolons. It's a reasonable assumption for the time being, but technically
15 # it could cause problems for some code.
17 OUTER: while ($line = <STDIN>) {
18 if ($line =~ /SMPI_VARINIT/) {
20 chomp $line; # kill carriage return
21 $line =~ s/\s+/ /g; # remove excessive whitespace added by spatch
22 while ($line =~ s/(SMPI_VARINIT[A-Z0-9_]*?\(.*?\))//) {
26 # if varinit continues on to next line
27 if ($line =~ /SMPI_VARINIT/) {
28 # should only happen for bad code...
29 if (!($nextline = <STDIN>)) {
35 } while ($line =~ /SMPI_VARINIT/);