pgcc warnings coming from system headers

Problem: warnings from system headers that are hard to eliminate.

File x.c:

#define min(a,b) ((a)>(b)?(b):(a))
#include <stdlib.h>
#include <stdint.h>

Compile it and observe the warnings:

pgcc -c x.c
PGC-W-0221-Redefinition of symbol min (C:/mkl/cache/pgi/15.5/Microsoft Open Tools 12/include\stdlib.h: 922)
PGC-W-0221-Redefinition of symbol SIZE_MAX (C:\mkl\cache\pgi\15.5/win64/15.5/include\stdint.h: 270)
PGC/x86-64 Windows 15.5-0: compilation completed with warnings

Both warnings should be fixed by wrapping the ‘Redefinitions’ with #ifdef.

The SIZE_MAX warning goes away if stdint.h is included before stdlib.h, which a large source base cannot always guarantee.

I would be much obliged to you if you check and let me know if the issue reproduces, and whether it has already been fixed in later release of PGI compilers.


PGI$ more min.c
#define min(a,b) ((a)>(b)?(b):(a))
#include <stdlib.h>
#include <stdint.h>

int main()
int a=10; int b=11;

printf(" hello - the min of a and b is %d\n",min(a,b));

PGI$ pgcc -o min min.c
PGC-W-0221-Redefinition of symbol min (C:/Program Files (x86)/Windows Kits/10/In
clude/10.0.10586.0/ucrt\stdlib.h: 1285)
PGC/x86-64 Windows 16.5-0: compilation completed with warnings
PGI$ ./min.exe
hello - the min of a and b is 10

So there is one less warning.

Thank you for checking.