I didn't like PetscCall(ierr) in Fortran because it is strange, even 
freakish. PetscCall(AFunction(args)) makes sense in C but IMHO "call 
AFunction(args,ierr); PetscCall(ierr)" looks weird, what are you calling? 
Nothing. I'd like to keep CHKERRQ(ierr) in Fortran and not support 
PetscCall(ierr) in Fortran. 

  Now depending on how the Fortran preprocessor handles args could we have 
PetscCall(AFunction(args,ierr)) in Fortran that turns into "call 
AFunction(args,ierr); CHKERRQ(ierr)"? It is perhaps weird Fortran but mimics 
and is largely consistent with C. We could also keep CHKERRQ() permanently for 
Fortran purists who are freaked out by PetscCall(AFunction(args,ierr)) in 
Fortran

  Barry

So long as ierr is always spelled as ierr probably 

#define PetscCall(A) call A; CHKERR(ierr) 

will probably work.




> On Apr 26, 2022, at 7:02 PM, Satish Balay via petsc-dev 
> <[email protected]> wrote:
> 
> Hm we reverted all fortran examples to use CHKERRQ(). [from PetscCall] so 
> presumably CHKERRQ() is still the preferred interface from fortran?
> 
> Satish
> 
> On Tue, 26 Apr 2022, Jacob Faibussowitsch wrote:
> 
>> Hi Glenn,
>> 
>> `PetscCall()` is the future, apologies for the confusion.
>> 
>> `CHKERRQ()` was mistakenly deleted from the fortran include files but exists 
>> for backwards-compatibility only.
>> 
>> Unlike “normal” changes we opted not to formally deprecate `CHKERRQ()` and 
>> friends (complete with compiler warnings) since they are so widely used.
>> 
>> Best regards,
>> 
>> Jacob Faibussowitsch
>> (Jacob Fai - booss - oh - vitch)
>> 
>>> On Apr 26, 2022, at 17:36, Hammond, Glenn E via petsc-dev 
>>> <[email protected]> wrote:
>>> 
>>> PETSc,
>>> 
>>> I see that CHKERRQ is back in the Fortran interface after 3.17.1.  Will 
>>> CHKERRQ be removed in the future?  I just wrote a script to refactor 
>>> PFLOTRAN [CHKERRQ() -> PetscCall()], and I want to know which direction to 
>>> head before asking everything to check in all their dev branches.  If 
>>> CHKERRQ() is available with Fortran for the future, I will abandon the 
>>> script and leave the devs alone.
>>> 
>>> Thanks,
>>> 
>>> Glenn
>> 

Reply via email to