[petsc-dev] __SDIR__ as string or not

Lisandro Dalcin dalcinl at gmail.com
Tue Mar 2 18:04:07 CST 2010


This is the proper way (at least it works for me)

#define PetscStringizeArg(a) #a
#define PetscStringize(a) PetscStringizeArg(a)
#define __SDIR__ PetscStringize(__INSDIR__)

Pushed: http://petsc.cs.iit.edu/petsc/petsc-dev/rev/bfc0690be7ce


On 2 March 2010 19:52, Lisandro Dalcin <dalcinl at gmail.com> wrote:
> On 2 March 2010 19:45, Barry Smith <bsmith at mcs.anl.gov> wrote:
>>
>>  Well Lisandro sent me down this path, so he can fix it.
>>
>
> Well, you did not follow the patch exactly... I'll take a look.
>
>
>>  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
>>
>>
>
>
>
> --
> Lisandro Dalcin
> ---------------
> Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
> Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
> Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
> PTLC - Güemes 3450, (3000) Santa Fe, Argentina
> Tel/Fax: +54-(0)342-451.1594
>



-- 
Lisandro Dalcin
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594



More information about the petsc-dev mailing list