-
Notifications
You must be signed in to change notification settings - Fork 174
Open
Labels
L: C-SourcesIssue addresses Modelica/Resources/C-SourcesIssue addresses Modelica/Resources/C-Sourcestool-issueIssue targets a specific Modelica tool onlyIssue targets a specific Modelica tool only
Description
When upgrading compiler from MinGW 8 to MinGW 15 on Windows I get below compiler errors (both for 32-bit and 64-bit).
ModelicaInternal.c: In function 'ModelicaInternal_mkdir':
ModelicaInternal.c:371:18: error: implicit declaration of function '_mkdir'; did you mean 'mkdir'? [-Wimplicit-function-declaration]
371 | int result = _mkdir(directoryName);
ModelicaInternal.c: In function 'ModelicaInternal_chdir':
ModelicaInternal.c:1170:18: error: implicit declaration of function '_chdir'; did you mean 'chdir'? [-Wimplicit-function-declaration]
1170 | int result = _chdir(directoryName);
I can see two reasons for triggering those:
- Something has changed for MinGW that requires updates of the pre-processor variables controlling the compliation.
- gcc in MinGW is more picky about implicit declarations and reports them as error instead of warnings.
Since I've noticed other unrelated implicit declarations errors when upgrading to MinGW 15 I'm inclined to favor the second. I.e. the declaration has been implicit also earlier but has passed unnoticed. So perhaps the preprocessor variables are simply not fully adopted for MinGW?
A possible fix is to move the || defined(__GNUC__)
higher up to handle MinGW on Windows orrectly.
#if defined(__WATCOMC__) || defined(__LCC__) || defined(__GNUC__)
int result = mkdir(directoryName);
#elif defined(__BORLANDC__) || defined(_WIN32)
and similar for chdir
.
Metadata
Metadata
Assignees
Labels
L: C-SourcesIssue addresses Modelica/Resources/C-SourcesIssue addresses Modelica/Resources/C-Sourcestool-issueIssue targets a specific Modelica tool onlyIssue targets a specific Modelica tool only