[Bug 276810] [exp-run] science/netcdf: rename '_FillValue' macro to 'NC_FillValue'

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 03 Feb 2024 18:39:10 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=276810

            Bug ID: 276810
           Summary: [exp-run] science/netcdf: rename '_FillValue' macro to
                    'NC_FillValue'
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: Ports Framework
          Assignee: portmgr@FreeBSD.org
          Reporter: dim@FreeBSD.org
                CC: ports-bugs@FreeBSD.org

While investigating build failures for bug 276104 (clang 18 exp-run), I noticed
the following problem with science/netcdf-cxx, which is ultimately caused by
its dependency, science/netcdf:

libtool: compile:  c++ -DHAVE_CONFIG_H -I. -I.. -fPIC -DPIC -isystem
/usr/local/include -O2 -pipe -fstack-protector-strong -isystem
/usr/local/include -fno-strict-aliasing -isystem /usr/local/include -MT
ncAtt.lo -MD -MP -MF .deps/ncAtt.Tpo -c ncAtt.cpp  -fPIC -DPIC -o .libs/ncAtt.o
In file included from ncAtt.cpp:1:
In file included from ./ncAtt.h:2:
In file included from ./ncException.h:3:
In file included from /usr/include/c++/v1/iostream:44:
In file included from /usr/include/c++/v1/istream:170:
In file included from /usr/include/c++/v1/ostream:187:
In file included from /usr/include/c++/v1/bitset:133:
/usr/include/c++/v1/__bit_reference:176:16: error: expected ',' or '>' in
template-parameter-list
  176 | template <bool _FillValue, class _Cp>
      |                ^
/usr/local/include/netcdf.h:113:25: note: expanded from macro '_FillValue'
  113 | #define _FillValue      "_FillValue"
      |                         ^

and lots more of these errors.

The problem is that netcdf defines a macro named '_FillValue', but names
starting with underscores are reserved for system headers. In this case, libc++
18 uses the same identifier '_FillValue' for a template argument. But because
netcdf's definition expands to a literal string, this results in compile
errors.

I have submitted https://github.com/Unidata/netcdf-c/issues/2858 to ask
upstream netcdf-c about this, but pending their answer, I would like to suggest
an exp-run with the '_FillValue' macro being renamed to 'NC_FillValue', to get
an idea of the fallout.

-- 
You are receiving this mail because:
You are on the CC list for the bug.