On 06/21/2011 03:50 AM, James Youngman wrote: > On Mon, Jun 20, 2011 at 11:34 PM, Bruno Haible <br...@clisp.org> wrote: >> I find it reasonable to use "#ifdef PATH_MAX" in front of every use of >> PATH_MAX, like POSIX requires. > > I agree. > > I think it would be helpful if there were some automated way of > reminding people to do that though. Many people develop on systems > which define PATH_MAX but would want their code to build and work > correctly on systems that do not. > > Is the current syntax-check system flexible enough to warn about uses > of PATH_MAX outside an #idfef PATH_MAX conditional?
It's easy enough to do a syntax check for the regex '\[PATH_MAX' for use of PATH_MAX as an array bound, but not as easy for checking that PATH_MAX is not used without #ifdef PATH_MAX and/or inclusion of pathmax.h. Perhaps we could also enhance -DGNULIB_POSIXCHECK to intentionally #undef PATH_MAX, to make sure that code still compiles when it is undefined, but I'm not quite sure how best to do that without an override for <limits.h>. -- Eric Blake ebl...@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature