_NETBSD_SOURCE defines some extra functions, which may use reserved names. The following patch avoids this problem.
OK? Index: sys/featuretest.h =================================================================== RCS file: /cvsroot/src/sys/sys/featuretest.h,v retrieving revision 1.10 diff -u -r1.10 featuretest.h --- sys/featuretest.h 26 Apr 2013 18:29:06 -0000 1.10 +++ sys/featuretest.h 30 Aug 2020 10:38:00 -0000 @@ -66,7 +66,8 @@ #endif #if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) && \ - !defined(_XOPEN_SOURCE) && !defined(_NETBSD_SOURCE) + !defined(_XOPEN_SOURCE) && !defined(_NETBSD_SOURCE) && \ + !defined(__STRICT_ANSI__) #define _NETBSD_SOURCE 1 #endif --------------- Following test case should not error, because major is not a reserved word in C++. #!/bin/sh cat << EOF > test.cpp #include <sys/types.h> int major(int a, int b, int c, int d) { return 3; } int main() { return major(1,2,3,4); } EOF c++ test.cpp -std=c++14 Output is: test.cpp:3:18: error: too many arguments provided to function-like macro invocation int major(int a, int b, int c, int d) { return 3; } ^ /usr/include/sys/types.h:264:9: note: macro 'major' defined here #define major(x) ((devmajor_t)(((uint32_t)(x) & 0x000fff00) >> 8)) ^ test.cpp:3:41: error: expected expression int major(int a, int b, int c, int d) { return 3; } ^ test.cpp:3:52: error: expected ';' after top level declarator int major(int a, int b, int c, int d) { return 3; } ^ ; test.cpp:5:17: error: too many arguments provided to function-like macro invocation return major(1,2,3,4); ^ /usr/include/sys/types.h:264:9: note: macro 'major' defined here #define major(x) ((devmajor_t)(((uint32_t)(x) & 0x000fff00) >> 8)) ^ 4 errors generated.