Skip to content

oc2: Rename macro to fix unity build#3347

Merged
WardF merged 1 commit intoUnidata:mainfrom
jschueller:patch-2
Apr 7, 2026
Merged

oc2: Rename macro to fix unity build#3347
WardF merged 1 commit intoUnidata:mainfrom
jschueller:patch-2

Conversation

@jschueller
Copy link
Copy Markdown
Contributor

No description provided.

@WardF
Copy link
Copy Markdown
Member

WardF commented Apr 4, 2026

It's a basic enough fix, can you say a bit about how this was discovered? I'm unaware that anybody was using netCDf with Unity and would be curious about the use case.

@jschueller
Copy link
Copy Markdown
Contributor Author

setting CMAKE_UNITY_BUILD=ON triggers it:

[  5%] Building C object oc2/CMakeFiles/oc2.dir/Unity/unity_0_c.c.o
In file included from .../netcdf-c/build/oc2/CMakeFiles/oc2.dir/Unity/unity_0_c.c:16:
.../netcdf-c/oc2/occompile.c:445:13: error: expected ';', ',' or ')' before string constant
  445 | #define tag "Error {\n"
      |             ^~~~~~~~~~~
.../netcdf-c/include/ncutil.h:76:59: note: in expansion of macro 'tag'
   76 | EXTERNL int NC_testpathmode(const char* path, const char* tag);
      |                                                           ^~~
.../netcdf-c/oc2/occompile.c:445:13: error: expected ';', ',' or ')' before string constant
  445 | #define tag "Error {\n"
      |             ^~~~~~~~~~~
.../netcdf-c/include/ncutil.h:77:56: note: in expansion of macro 'tag'
   77 | EXTERNL int NC_testmode(struct NCURI* uri, const char* tag);
      |                                                        ^~~
.../netcdf-c/oc2/occompile.c:445:13: error: expected ';', ',' or ')' before string constant
  445 | #define tag "Error {\n"
      |             ^~~~~~~~~~~
.../netcdf-c/include/ncutil.h:78:58: note: in expansion of macro 'tag'
   78 | EXTERNL int NC_addmodetag(struct NCURI* uri, const char* tag);
      |                                                          ^~~
make[2]: *** [oc2/CMakeFiles/oc2.dir/build.make:93: oc2/CMakeFiles/oc2.dir/Unity/unity_0_c.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:2909: oc2/CMakeFiles/oc2.dir/all] Error 2
make: *** [Makefile:166: all] Error 2

@WardF
Copy link
Copy Markdown
Member

WardF commented Apr 7, 2026

Oh and here I got confused about what UNITY was referring to. Thanks!

@WardF WardF merged commit 60dcb67 into Unidata:main Apr 7, 2026
104 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants