Skip to content

compat: Fix MSYS2 platform build#26

Merged
patrick-stephens merged 4 commits into
masterfrom
fix-errors-on-msys2
Nov 25, 2022
Merged

compat: Fix MSYS2 platform build#26
patrick-stephens merged 4 commits into
masterfrom
fix-errors-on-msys2

Conversation

@cosmo0920
Copy link
Copy Markdown
Contributor

To build with MSYS2, we don't need to use these trivial macros on cfl_compat.h.

Otherwise, they cause the following errors:

In file included from C:\Users\cosmo\Documents\GitHub\cfl\src\cfl_time.c:29:
C:/Users/cosmo/Documents/GitHub/cfl/include/cfl/cfl_compat.h:40:16: error: '__tzname' declared as function returning an array
   40 | #define tzname _tzname
      |                ^~~~~~~
C:/Users/cosmo/Documents/GitHub/cfl/include/cfl/cfl_compat.h:40:16: error: conflicting types for '__tzname'; have 'int(
'
C:/Ruby31-x64/msys64/ucrt64/include/time.h:123:26: note: previous declaration of '__tzname' with type 'char **(void)'
  123 |   _CRTIMP char **__cdecl __tzname(void);
      |                          ^~~~~~~~
C:/Users/cosmo/Documents/GitHub/cfl/include/cfl/cfl_compat.h:39:18: error: expected '{' before '(' token
   39 | #define timezone _timezone
      |                  ^~~~~~~~~
C:/Users/cosmo/Documents/GitHub/cfl/include/cfl/cfl_compat.h:39:18: error: expected '{' before '(' token
   39 | #define timezone _timezone
      |                  ^~~~~~~~~
mingw32-make[2]: *** [src\CMakeFiles\cfl-static.dir\build.make:121: src/CMakeFiles/cfl-static.dir/cfl_time.c.obj] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:157: src/CMakeFiles/cfl-static.dir/all] Error 2

Signed-off-by: Hiroshi Hatake hatake@calyptia.com

To build with MSYS2, we don't need to use these trivial macros on cfl_compat.h.

Otherwise, they cause the following errors:

```log
In file included from C:\Users\cosmo\Documents\GitHub\cfl\src\cfl_time.c:29:
C:/Users/cosmo/Documents/GitHub/cfl/include/cfl/cfl_compat.h:40:16: error: '__tzname' declared as function returning an array
   40 | #define tzname _tzname
      |                ^~~~~~~
C:/Users/cosmo/Documents/GitHub/cfl/include/cfl/cfl_compat.h:40:16: error: conflicting types for '__tzname'; have 'int(
'
C:/Ruby31-x64/msys64/ucrt64/include/time.h:123:26: note: previous declaration of '__tzname' with type 'char **(void)'
  123 |   _CRTIMP char **__cdecl __tzname(void);
      |                          ^~~~~~~~
C:/Users/cosmo/Documents/GitHub/cfl/include/cfl/cfl_compat.h:39:18: error: expected '{' before '(' token
   39 | #define timezone _timezone
      |                  ^~~~~~~~~
C:/Users/cosmo/Documents/GitHub/cfl/include/cfl/cfl_compat.h:39:18: error: expected '{' before '(' token
   39 | #define timezone _timezone
      |                  ^~~~~~~~~
mingw32-make[2]: *** [src\CMakeFiles\cfl-static.dir\build.make:121: src/CMakeFiles/cfl-static.dir/cfl_time.c.obj] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:157: src/CMakeFiles/cfl-static.dir/all] Error 2
```

Signed-off-by: Hiroshi Hatake <hatake@calyptia.com>
@cosmo0920
Copy link
Copy Markdown
Contributor Author

cosmo0920 commented Nov 24, 2022

This can be tested by cd build && cmake .. -G "MinGW Makefiles" && cmake --build . on MSYS2 terminal (mintty).

@cosmo0920 cosmo0920 force-pushed the fix-errors-on-msys2 branch 9 times, most recently from 8aca949 to 201536a Compare November 25, 2022 03:03
Signed-off-by: Hiroshi Hatake <hatake@calyptia.com>
From POSIX specification, fputs should non-negative number if succeeded.
When it fails, it should return EOF not negative number.

Signed-off-by: Hiroshi Hatake <hatake@calyptia.com>
Signed-off-by: Hiroshi Hatake <hatake@calyptia.com>
@patrick-stephens patrick-stephens merged commit 326ecb5 into master Nov 25, 2022
@patrick-stephens patrick-stephens deleted the fix-errors-on-msys2 branch November 25, 2022 09:31
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