[petsc-dev] __SDIR__ as string or not

Jed Brown jed at 59A2.org
Tue Mar 2 16:34:15 CST 2010

On Wed, 24 Feb 2010 16:16:43 -0600, Barry Smith <bsmith at mcs.anl.gov> wrote:
>    Lisandro suggested changing the model to use -D__INSDIR__=directory  
> with no quotes and then in petscerror.h have
> #define PetscStringize(a) #a
> #define __SDIR__ PetscStringize(__INSDIR__)

Did you notice that all the error messages read like this now?

  [0]PETSC ERROR: ISSetPermutation() line 141 in __INSDIR__index.c

Quoting from C99 Rescanning and further replacement:

 1  After all parameters in the replacement list have been substituted and # and ##
    processing has taken place, all placemarker preprocessing tokens are removed. Then, the
    resulting preprocessing token sequence is rescanned, along with all subsequent
    preprocessing tokens of the source file, for more macro names to replace.

As far as I know, there is no way to get the preprocessor to stringize
the expansion of __INSDIR__.

Note that a possible alternative to __SDIR__ is to send the full path
name to the compiler, as in `pwd`/source, in which case __FILE__ would
have the full path.


More information about the petsc-dev mailing list