Skip to content

Commit fc29f95

Browse files
committed
Disable MSVC warnings in cmake instead
1 parent db61229 commit fc29f95

File tree

4 files changed

+9
-51
lines changed

4 files changed

+9
-51
lines changed

openmp/cmake/HandleOpenMPOptions.cmake

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,12 @@ append_if(OPENMP_HAVE_WMAYBE_UNINITIALIZED_FLAG "-Wno-maybe-uninitialized" CMAKE
4141
append_if(OPENMP_HAVE_NO_SEMANTIC_INTERPOSITION "-fno-semantic-interposition" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
4242
append_if(OPENMP_HAVE_FUNCTION_SECTIONS "-ffunction-section" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
4343
append_if(OPENMP_HAVE_DATA_SECTIONS "-fdata-sections" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
44+
45+
if (MSVC)
46+
# Disable "warning C4201: nonstandard extension used: nameless struct/union"
47+
append("-wd4201" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
48+
49+
# Disable "warning C4190: '__kmpc_atomic_cmplx8_rd' has C-linkage specified, but returns
50+
# UDT '__kmp_cmplx64_t' which is incompatible with C"
51+
append("-wd4190" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
52+
endif()

openmp/runtime/src/kmp.h

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -502,21 +502,13 @@ static inline kmp_sched_t __kmp_sched_without_mods(kmp_sched_t kind) {
502502
}
503503

504504
/* Type to keep runtime schedule set via OMP_SCHEDULE or omp_set_schedule() */
505-
#if KMP_COMPILER_MSVC
506-
#pragma warning(push)
507-
// warning C4201: nonstandard extension used: nameless struct/union
508-
#pragma warning(disable : 4201)
509-
#endif
510505
typedef union kmp_r_sched {
511506
struct {
512507
enum sched_type r_sched_type;
513508
int chunk;
514509
};
515510
kmp_int64 sched;
516511
} kmp_r_sched_t;
517-
#if KMP_COMPILER_MSVC
518-
#pragma warning(pop)
519-
#endif
520512

521513
extern enum sched_type __kmp_sch_map[]; // map OMP 3.0 schedule types with our
522514
// internal schedule types
@@ -1905,20 +1897,12 @@ typedef struct KMP_ALIGN_CACHE dispatch_private_info32 {
19051897
// Because of parm1-4 are used together, performance seems to be better
19061898
// if they are on the same cache line (not measured though).
19071899

1908-
#if KMP_COMPILER_MSVC
1909-
#pragma warning(push)
1910-
// warning C4201: nonstandard extension used: nameless struct/union
1911-
#pragma warning(disable : 4201)
1912-
#endif
19131900
struct KMP_ALIGN(32) {
19141901
kmp_int32 parm1;
19151902
kmp_int32 parm2;
19161903
kmp_int32 parm3;
19171904
kmp_int32 parm4;
19181905
};
1919-
#if KMP_COMPILER_MSVC
1920-
#pragma warning(pop)
1921-
#endif
19221906

19231907
#if KMP_WEIGHTED_ITERATIONS_SUPPORTED
19241908
kmp_uint32 pchunks;
@@ -1952,20 +1936,12 @@ typedef struct KMP_ALIGN_CACHE dispatch_private_info64 {
19521936
// b) all parm1-4 are in the same cache line.
19531937
// Because of parm1-4 are used together, performance seems to be better
19541938
// if they are in the same line (not measured though).
1955-
#if KMP_COMPILER_MSVC
1956-
#pragma warning(push)
1957-
// warning C4201: nonstandard extension used: nameless struct/union
1958-
#pragma warning(disable : 4201)
1959-
#endif
19601939
struct KMP_ALIGN(32) {
19611940
kmp_int64 parm1;
19621941
kmp_int64 parm2;
19631942
kmp_int64 parm3;
19641943
kmp_int64 parm4;
19651944
};
1966-
#if KMP_COMPILER_MSVC
1967-
#pragma warning(pop)
1968-
#endif
19691945

19701946
#if KMP_WEIGHTED_ITERATIONS_SUPPORTED
19711947
kmp_uint64 pchunks;
@@ -2247,11 +2223,6 @@ union KMP_ALIGN_CACHE kmp_barrier_union {
22472223

22482224
typedef union kmp_barrier_union kmp_balign_t;
22492225

2250-
#if KMP_COMPILER_MSVC
2251-
#pragma warning(push)
2252-
// warning C4201: nonstandard extension used: nameless struct/union
2253-
#pragma warning(disable : 4201)
2254-
#endif
22552226
/* Team barrier needs only non-volatile arrived counter */
22562227
union KMP_ALIGN_CACHE kmp_barrier_team_union {
22572228
double b_align; /* use worst case alignment */
@@ -2268,9 +2239,6 @@ union KMP_ALIGN_CACHE kmp_barrier_team_union {
22682239
#endif
22692240
};
22702241
};
2271-
#if KMP_COMPILER_MSVC
2272-
#pragma warning(pop)
2273-
#endif
22742242

22752243
typedef union kmp_barrier_team_union kmp_balign_team_t;
22762244

openmp/runtime/src/kmp_atomic.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,13 +1030,6 @@ kmp_cmplx32 __kmpc_atomic_cmplx4_rd(ident_t *id_ref, int gtid,
10301030
kmp_cmplx32 *loc);
10311031
#endif
10321032

1033-
#if KMP_COMPILER_MSVC
1034-
#pragma warning(push)
1035-
// warning C4190: '__kmpc_atomic_cmplx8_rd' has C-linkage specified, but returns
1036-
// UDT '__kmp_cmplx64_t' which is incompatible with C
1037-
#pragma warning(disable : 4190)
1038-
#endif
1039-
10401033
kmp_cmplx64 __kmpc_atomic_cmplx8_rd(ident_t *id_ref, int gtid,
10411034
kmp_cmplx64 *loc);
10421035
kmp_cmplx80 __kmpc_atomic_cmplx10_rd(ident_t *id_ref, int gtid,
@@ -1597,10 +1590,6 @@ kmp_cmplx128_a16_t __kmpc_atomic_cmplx16_a16_swp(ident_t *id_ref, int gtid,
15971590
#endif
15981591
#endif
15991592

1600-
#if KMP_COMPILER_MSVC
1601-
#pragma warning(pop)
1602-
#endif
1603-
16041593
// Capture routines for mixed types (RHS=float16)
16051594
#if KMP_HAVE_QUAD
16061595

openmp/runtime/src/kmp_dispatch.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,6 @@ template <typename T> struct dispatch_private_infoXX_template {
8181

8282
/* parm[1-4] are used in different ways by different scheduling algorithms */
8383

84-
#if KMP_COMPILER_MSVC
85-
#pragma warning(push)
86-
// warning C4201: nonstandard extension used: nameless struct/union
87-
#pragma warning(disable : 4201)
88-
#endif
8984
// KMP_ALIGN(32) ensures ( if the KMP_ALIGN macro is turned on )
9085
// a) parm3 is properly aligned and
9186
// b) all parm1-4 are in the same cache line.
@@ -97,9 +92,6 @@ template <typename T> struct dispatch_private_infoXX_template {
9792
T parm3;
9893
T parm4;
9994
};
100-
#if KMP_COMPILER_MSVC
101-
#pragma warning(pop)
102-
#endif
10395

10496
#if KMP_WEIGHTED_ITERATIONS_SUPPORTED
10597
UT pchunks; // total number of chunks for processes with p-core

0 commit comments

Comments
 (0)