[petsc-dev] Request for comments: allow C99 internally

Satish Balay balay at mcs.anl.gov
Sat Mar 7 08:57:07 CST 2020


On Sat, 7 Mar 2020, Jed Brown wrote:

> Satish Balay <balay at mcs.anl.gov> writes:
> 
> > On Fri, 6 Mar 2020, Jed Brown wrote:
> >>   PetscInt some,several,variables;
> >> 
> >>   // code
> >>   if (PetscDefined(HAVE_MAGIC)) {
> >>     function(several,&variables);
> >>   }
> >>   use(some,variables);
> >
> > One minor issue: we haven't yet fixed up clang analyzer build. Likely this will be listed as 'dead code' block or something like that.
> 
> As with #ifdef, accurate code coverage needs to be aggregated across
> multiple configurations.  Are you aware of other problems?

None that I can think off now..

Satish

> 
> >> This approach could also be used to avoid needing separate macros for
> >> every SETERRQ1-SETERRQ9, etc.  I have an example implementation in this
> >> MR, and it passes the full pipeline (after relaxing the -std=c89
> >> -pedantic build).
> >
> > These are in public includes. So apps using -std=c89 won't have access to this part of the API?
> 
> Oh, I would keep the macros for a while (perhaps with gradual
> deprecation starting eventually), just define the new ones for supported
> dialects and use the new ones internally.
> 



More information about the petsc-dev mailing list