warnings in omp.h from Clang

Hello,
I’ve installed Clang 9.0 on my Mac using MacPorts. When I compile a C/OpenMP program with the flag -pedantic, I get 4 warnings, all of the same kind, in omp.h, e.g. "ISO C restricts enumerator values to range of 'int' (2147483648 is too large)”. An example is below. Do other people get this, or am I doing something wrong?
Thanks,
Steve

basie:diffusion1d siegel$ cat exp.c
#include <omp.h>
int main() {
}

basie:diffusion1d siegel$ clang-mp-9.0 -fopenmp -pedantic exp.c
In file included from exp.c:1:
/opt/local/include/libomp/omp.h:53:9: warning: ISO C restricts enumerator values to range of 'int'
      (2147483648 is too large) [-Wpedantic]
        omp_sched_monotonic = 0x80000000
        ^ ~~~~~~~~~~
/opt/local/include/libomp/omp.h:302:7: warning: ISO C restricts enumerator values to range of 'int'
      (18446744073709551615 is too large) [-Wpedantic]
      KMP_ALLOCATOR_MAX_HANDLE = UINTPTR_MAX
      ^ ~~~~~~~~~~~
/opt/local/include/libomp/omp.h:315:7: warning: ISO C restricts enumerator values to range of 'int'
      (18446744073709551615 is too large) [-Wpedantic]
      KMP_MEMSPACE_MAX_HANDLE = UINTPTR_MAX
      ^ ~~~~~~~~~~~
/opt/local/include/libomp/omp.h:343:39: warning: ISO C restricts enumerator values to range of 'int'
      (18446744073709551615 is too large) [-Wpedantic]
    typedef enum omp_event_handle_t { KMP_EVENT_MAX_HANDLE = UINTPTR_MAX } omp_event_handle_t;
                                      ^ ~~~~~~~~~~~
4 warnings generated.
basie:diffusion1d siegel$ more /opt/local/include/libomp/omp.h
/*
* include/omp.h.var
*/

//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef __OMP_H
# define __OMP_H

# include <stdlib.h>
# include <stdint.h>

# define KMP_VERSION_MAJOR 5
# define KMP_VERSION_MINOR 0
# define KMP_VERSION_BUILD 20140926
# define KMP_BUILD_DATE "No_Timestamp"

Hi Steve,

You observed expected problem, and I am not sure if it can be solved. Probably clang could suppress the warnings somehow, though I am not a compiler expert.

The omp_sched_monotonic is the part of OpenMP standard, which does not correspond well with the ISO C here.

The omp_*_handle_t were intentionally made enumerators with the intention to store pointers there. That's why UINTPRT_MAX used to emphasize the size of the enumerator.
The argument was that the advantage of enumeration versus integer for compilation (allows stricter type checking) overweighs the disadvantage of its non-conformance with the ISO C. Especially given that "all" known compilers support an extension that allows enumerator to be as big as any integer type.

Interestingly gcc does not complain on omp_sched_monotonic by default, but starts complaining if you point to its own include file via -I option (tried gcc version 9.3).

Regards,
Andrey

Thanks, Andrey. Your answer clued me in to a solution…

basie:tmp siegel$ clang-mp-9.0 -fopenmp -isystem /opt/local/include/libomp -pedantic exp.c
basie:tmp siegel$

System files included from an -isystem path don’t have warnings reported (in gcc or clang).
I guess gcc -fopenmp adds the -isystem for you, but clang doesn’t. Probably would be a good idea to make that change to clang.

-Steve