<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Feb 7, 2013 at 9:56 PM, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div id=":4ze"> I have removed the use of <span class="">PETSC_NULL</span> from all <span class="">PETSc</span> C code. Please remember to just use <span class="">NULL</span> in <span class="">PETSc</span> source code in the future (or Karl's script will find you).</div>
</blockquote></div><br>I see you changed to</div><div class="gmail_extra"><br></div><div class="gmail_extra" style>#define PETSC_IGNORE NULL</div><div class="gmail_extra" style><br></div><div class="gmail_extra" style>but kept</div>
<div class="gmail_extra" style><br></div><div class="gmail_extra" style>#define PETSC_NULL 0</div><div class="gmail_extra" style><br></div><div class="gmail_extra" style>Should the second be updated to</div><div class="gmail_extra" style>
<br></div><div class="gmail_extra" style>#define PETSC_NULL NULL</div><div class="gmail_extra" style><br></div><div class="gmail_extra" style>because it is stricter about passing PETSC_NULL for an integer argument?</div><div class="gmail_extra" style>
<br></div><div class="gmail_extra" style>Also, we could do something like this (properly guarded, of course):</div><div class="gmail_extra" style><br></div><div class="gmail_extra" style><div class="gmail_extra">__attribute__((deprecated)) PETSC_UNUSED</div>
<div class="gmail_extra">PETSC_STATIC_INLINE void PETSC_NULL_IS_DEPRECATED_JUST_USE_NULL() {};</div><div class="gmail_extra">#define PETSC_NULL           (PETSC_NULL_IS_DEPRECATED_JUST_USE_NULL(),NULL)</div><div><br></div>
<div style>which can be used for any compiler that supports non-static statements in declarations (everything but Sun and MSVC?) and has __attribute__((deprecated)). This produces warnings like this under Clang</div><div style>
<br></div><div style><div>ex5.c:102:36: warning: 'PETSC_NULL_IS_DEPRECATED_JUST_USE_NULL' is deprecated [-Wdeprecated-declarations]</div><div>  ierr       = PetscOptionsGetReal(PETSC_NULL,"-par",&user.param,NULL);CHKERRQ(ierr);</div>
<div>                                   ^</div><div>/home/jed/petsc/include/petscsys.h:387:31: note: expanded from macro 'PETSC_NULL'</div><div>#define PETSC_NULL           (PETSC_NULL_IS_DEPRECATED_JUST_USE_NULL(),NULL)</div>
<div>                              ^</div><div>/home/jed/petsc/include/petscsys.h:385:33: note: 'PETSC_NULL_IS_DEPRECATED_JUST_USE_NULL' declared here</div><div>PETSC_UNUSED static inline void PETSC_NULL_IS_DEPRECATED_JUST_USE_NULL() {};</div>
<div>                                ^</div><div>1 warning generated.</div><div><br></div><div>and like this with GCC:</div><div><br></div><div><div>ex5.c: In function ‘main’:</div><div>ex5.c:102:3: warning: ‘PETSC_NULL_IS_DEPRECATED_JUST_USE_NULL’ is deprecated (declared at /home/jed/petsc/include/petscsys.h:385) [-Wdeprecated-declarations]</div>
</div><div><br></div><div><br></div><div style>We can make the error message cleaner (but more confusing) with</div><div style><br></div><div style><div>__attribute__((deprecated))</div><div>PETSC_UNUSED static inline void PETSC_NULL() {};</div>
<div>#define PETSC_NULL           (PETSC_NULL(),NULL)</div><div><br></div><div style>which produces:</div><div><br></div><div><div>ex5.c: In function ‘main’:</div><div>ex5.c:102:3: warning: ‘PETSC_NULL’ is deprecated (declared at /home/jed/petsc/include/petscsys.h:385) [-Wdeprecated-declarations]</div>
</div><div><br></div><div><br></div><div style>Any sense in this stuff?</div></div></div></div></div>