[petsc-dev] __SDIR__ as string or not

Barry Smith bsmith at mcs.anl.gov
Tue Mar 2 16:45:17 CST 2010


   Well Lisandro sent me down this path, so he can fix it.

   Barry

On Mar 2, 2010, at 4:34 PM, Jed Brown wrote:

> 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 6.10.3.4 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.
>
> Jed




More information about the petsc-dev mailing list