Hmm, would a pull request that required the compiler be C during the compile 
work? 

  #if defined(PETSC_HAVE_CLOSURE) && !defined(__cplusplus)

Barry






> On Aug 24, 2020, at 11:29 AM, Fande Kong <[email protected]> wrote:
> 
> Thanks for your reply, Jed.
> 
> 
> Barry, do you have any comment?
> 
> Fande,
> 
> On Thu, Aug 20, 2020 at 9:19 AM Jed Brown <[email protected] 
> <mailto:[email protected]>> wrote:
> Barry, this is a side-effect of your Swift experiment.  Does that need to be 
> in a header (even if it's a private header)?
> 
> The issue may be that you test with a C compiler and it gets included in C++ 
> source.
> 
> Fande Kong <[email protected] <mailto:[email protected]>> writes:
> 
> > Hi All,
> >
> > We (moose team) hit an error message when compiling PETSc, recently. The
> > error is related to "PETSC_HAVE_CLOSURE." Everything runs well if I am
> > going to turn this flag off by making the following changes:
> >
> >
> > git diff
> > diff --git a/config/BuildSystem/config/utilities/closure.py
> > b/config/BuildSystem/config/utilities/closure.py
> > index 6341ddf271..930e5b3b1b 100644
> > --- a/config/BuildSystem/config/utilities/closure.py
> > +++ b/config/BuildSystem/config/utilities/closure.py
> > @@ -19,8 +19,8 @@ class Configure(config.base.Configure):
> >   includes = '#include <stdio.h>\n'
> >   body = 'int (^closure)(int);'
> >   self.pushLanguage('C')
> > - if self.checkLink(includes, body):
> > - self.addDefine('HAVE_CLOSURE','1')
> > +# if self.checkLink(includes, body):
> > +# self.addDefine('HAVE_CLOSURE','1')
> >  def configure(self):
> >   self.executeTest(self.configureClosure)
> >
> >
> > I was wondering if there exists a configuration option to disable "Closure"
> > C syntax?  I did not find one by running "configuration --help"
> >
> > Please let me know if you need more information.
> >
> >
> > Thanks,
> >
> > Fande,
> >
> >
> > In file included from
> > /Users/milljm/projects/moose/scripts/../libmesh/src/solvers/petscdmlibmesh.C:25:
> > /Users/milljm/projects/moose/petsc/include/petsc/private/petscimpl.h:15:29:
> > warning: 'PetscVFPrintfSetClosure' initialized and declared 'extern'
> >   15 | PETSC_EXTERN PetscErrorCode PetscVFPrintfSetClosure(int (^)(const
> > char*));
> >    |              ^~~~~~~~~~~~~~~~~~~~~~~
> > /Users/milljm/projects/moose/petsc/include/petsc/private/petscimpl.h:15:53:
> > error: expected primary-expression before 'int'
> >   15 | PETSC_EXTERN PetscErrorCode PetscVFPrintfSetClosure(int (^)(const
> > char*));
> >    |                          ^~~
> >  CXX   src/systems/libmesh_opt_la-equation_systems_io.lo
> > In file included from
> > /Users/milljm/projects/moose/petsc/include/petsc/private/dmimpl.h:7,
> >          from
> > /Users/milljm/projects/moose/scripts/../libmesh/src/solvers/petscdmlibmeshimpl.C:26:
> > /Users/milljm/projects/moose/petsc/include/petsc/private/petscimpl.h:15:29:
> > warning: 'PetscVFPrintfSetClosure' initialized and declared 'extern'
> >   15 | PETSC_EXTERN PetscErrorCode PetscVFPrintfSetClosure(int (^)(const
> > char*));
> >    |              ^~~~~~~~~~~~~~~~~~~~~~~
> > /Users/milljm/projects/moose/petsc/include/petsc/private/petscimpl.h:15:53:
> > error: expected primary-expression before 'int'
> >   15 | PETSC_EXTERN PetscErrorCode PetscVFPrintfSetClosure(int (^)(const
> > char*));

Reply via email to