summaryrefslogtreecommitdiff
path: root/lib/sbin/cpp.pl
Commit message (Collapse)AuthorAge
* Warn if there are empty macro arguments. That is, givengoodale2005-12-13
| | | | | | | | | | | | | | | #define M2(a,b) warn about the uses M2(x,) or M2(,y) or M2(,). The empty arguments are still handled correctly. These warnings are only to make it easier to port to systems where the system cpp does not handle empty arguments and where one does not want to use the perl cpp instead. Patch from Erik Schnetter. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4213 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Correct ProcessIf: When evaluating a macro in an #if statement,schnetter2005-12-13
| | | | | | | | | | convert the macro value to either 0 or 1 before returning it. Otherwise things fail badly if the macro is defined but empty: The returned value is then not an integer, and cpp.pl would keep both the #if and the #else branch of an if statement. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4205 17b73243-c579-4c4c-a9d2-2d5706c11dac
* The perl cpp does not handle empty macro arguments correctly. Whenschnetter2005-10-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | the last macro argument is empty, it thinks there is one argument too few. That is, the following code #define M2(a,b) M2(x,) leads to an error message stating that M2 was used with only a single argument. This is wrong, as it is called with two arguments, where the second argument is the empty string. After reading the GNU cpp manual, I think that the ANSI standard requires that empty arguments must be handled. The problem is that the routine SplitArgs that decodes the macro arguments cannot distinguish between an empty last argument and no argument, as both are represented by an empty string. I change the routine so that an empty string always means "empty argument". This means that SplitArgs cannot be called any more if there are no arguments -- but this does not matter. I place a corresponding if statement around the call. Empty macro arguments may cause problems on some system. A later patch will produce warnings or errors for them. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4179 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Undo changes that prevent more unwanted warnings about unused variables.schnetter2005-09-28
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@4155 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Replace comments by nothing instead of whitespace to allow old-styleschnetter2005-09-26
| | | | | | | token concatenation. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4153 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Allow empty macro arguments.schnetter2005-09-26
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@4152 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Added a --version flag.goodale2004-03-27
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@3610 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Fixed regex which didn't match in perl 5.8.0.tradke2004-03-16
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@3590 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Bugfix - whitespace in the argument list of a macro definition ran intogoodale2003-05-14
| | | | | | | | | | | problems. PR 1467 - patch from Ian Hawke. This patch also allows space on a line before a pre-processor directive. Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@3216 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Don't complain when a macro with no arguments is followed by an expression ingoodale2003-03-19
| | | | | | | | | parentheses. Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@3178 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Fix bug in getting rid of /./ in pathnames.goodale2002-05-14
| | | | | | | Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@2814 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Allow spaces before and after the hash character in preprocessor directives.tradke2002-05-11
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@2808 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Simplify a pattern match (which didn't work on Darwin before).tradke2002-05-10
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@2806 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Added '#! /usr/bin/perl' as the first line. Now it can be executed directlytradke2002-05-07
| | | | | | | after it has been given execute permissions. git-svn-id: http://svn.cactuscode.org/flesh/trunk@2797 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Don't get confused by ( and ) in strings in macro arguments.goodale2002-04-25
| | | | | | | Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@2754 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Fixed to allow #if or #elif <constant|define>.goodale2002-04-24
| | | | | | | | | A couple of bugfixes for diagnostic code. Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@2750 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Critical bugfix in the way that if conditions are handled - now can buildgoodale2001-11-20
| | | | | | | | | | | | | | Einstein thorns and pass testsuite with this. Added output of # line stuff which si handy for debugging. Fixed hopefully the last place where it might try to replace a token which is in a string. Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@2468 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Now allows whitespace between macro name and arguments.goodale2001-11-20
| | | | | | | | | | | | Better handling of things in strings. Still doesn't work for ADM, so I was obviously too optinmistic in my last commit; you probably don;t want to use it yet. Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@2467 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Updated version of the perl cpp replacement. I can now build Cactus using this.goodale2001-11-20
| | | | | | | | | | | | | | | | | | | | | | | | If you feel brave and want to use this, edit configs/<config>/config-data/make.config.defn and change the CPP = <whatever> line to CPP = $(PERL) $(CCTK_HOME)/lib/sbin/cpp.pl I have tested this on the Fortran files from WaveToyF* and it works ok. Caveats: It will merrily go into a loop with recursive macro definitions. Some of its error messages may not be too friendly at the moment. Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@2466 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Start of a perl replacement cpp to stop all these annoying differences ↵goodale1999-09-15
between cpp on all the architectures. Almost works correctly for dependencies - still a bug or two to track down. Macros of the form #define a(b) not yet supported. Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@927 17b73243-c579-4c4c-a9d2-2d5706c11dac