Skip to content

Commit 7848bea

Browse files
Merge pull request #38624 from peterfpeterson/windows_suppress_warnings
Change windows macro for warnings into compiler flags - ornl-next
2 parents a258cfe + e47801e commit 7848bea

File tree

3 files changed

+26
-51
lines changed

3 files changed

+26
-51
lines changed

Framework/Kernel/inc/MantidKernel/System.h

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,14 @@
1717
*******************************************************************************/
1818

1919
/* A system-wide file to contain, e.g., useful system-dependent macros
20-
21-
@author Russell Taylor, Tessella Support Services plc
22-
@date 26/10/2007
23-
*/
20+
*
21+
* @author Russell Taylor, Tessella Support Services plc
22+
*/
2423

2524
/**
2625
* Definitions of the DLLImport compiler directives for MSVC
2726
*/
2827
#ifdef _WIN32
29-
// 'identifier' : class 'type' needs to have dll-interface to be used by clients
30-
// of class 'type2'
31-
// Things from the std library give these warnings and we can't do anything
32-
// about them.
33-
#pragma warning(disable : 4251)
34-
// Given that we are compiling everything with msvc under Windows and
35-
// linking all with the same runtime we can disable the warning about
36-
// inheriting from a non-exported interface, e.g. std::runtime_error */
37-
#pragma warning(disable : 4275)
38-
// Warning C4373: previous versions of the compiler did not override when
39-
// parameters only differed by const/volatile qualifiers
40-
// This is basically saying that it now follows the C++ standard and doesn't
41-
// seem useful
42-
#pragma warning(disable : 4373)
43-
4428
// Export/Import declarations
4529
#define DLLExport __declspec(dllexport)
4630
#define DLLImport __declspec(dllimport)

buildconfig/CMake/GenerateMantidExportHeader.cmake

Lines changed: 12 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,11 @@
11
include(GenerateExportHeader)
22
function(GENERATE_MANTID_EXPORT_HEADER TARGET_LIBRARY GENERATE_EXTERN)
33
string(TOUPPER "${TARGET_LIBRARY}" TARGET_NAME)
4-
set(CUSTOM "\n")
5-
6-
if(MSVC)
7-
set(CUSTOM
8-
"${CUSTOM}\n\
9-
#ifdef _WIN32\n\
10-
// 'identifier' : class 'type' needs to have dll-interface to be used by clients\n\
11-
// of class 'type2'\n\
12-
// Things from the std library give these warnings and we can't do anything\n\
13-
// about them.\n\
14-
#pragma warning(disable : 4251)\n\
15-
// Given that we are compiling everything with msvc under Windows and\n\
16-
// linking all with the same runtime we can disable the warning about\n\
17-
// inheriting from a non-exported interface, e.g. std::runtime_error */\n\
18-
#pragma warning(disable : 4275)\n\
19-
// Warning C4373: previous versions of the compiler did not override when\n\
20-
// parameters only differed by const/volatile qualifiers\n\
21-
// This is basically saying that it now follows the C++ standard and doesn't\n\
22-
// seem useful\n\
23-
#pragma warning(disable : 4373)\n\
24-
#endif\n\n\
25-
"
26-
)
27-
endif(MSVC)
28-
294
set(CUSTOM
30-
"${CUSTOM}\
31-
#ifndef UNUSED_ARG\n\
32-
#define UNUSED_ARG(x) (void) x;\n\
33-
#endif\n\n\
5+
"\n\
346
#ifndef ${TARGET_NAME}_DEPRECATED\n\
357
#define ${TARGET_NAME}_DEPRECATED(func) MANTID_${TARGET_NAME}_DEPRECATED func\n\
36-
#endif\n\n\
37-
"
8+
#endif\n\n"
389
)
3910

4011
if(GENERATE_EXTERN)
@@ -49,9 +20,18 @@ function(GENERATE_MANTID_EXPORT_HEADER TARGET_LIBRARY GENERATE_EXTERN)
4920
// EXTERN_IMPORT is defined in MantidKernel/System.h\n
5021
#define EXTERN_MANTID_${TARGET_NAME} EXTERN_IMPORT\n\
5122
#endif /* ${TARGET_LIBRARY}_EXPORTS*/\n\n\
52-
#include <cstdint>
5323
"
5424
)
25+
else()
26+
# UNUSED_ARG is defined and cstdint is included in MantidKernel/System.h
27+
set(CUSTOM
28+
"${CUSTOM}\
29+
#ifndef UNUSED_ARG\n\
30+
#define UNUSED_ARG(x) (void) x;\n\
31+
#endif\n\n\
32+
#include <cstdint>\n"
33+
)
34+
5535
endif(GENERATE_EXTERN)
5636

5737
generate_export_header(

buildconfig/CMake/WindowsSetup.cmake

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,19 @@ add_definitions(-D_SILENCE_CXX17_SHARED_PTR_UNIQUE_DEPRECATION_WARNING)
3030
set(CMAKE_CXX_FLAGS
3131
"${CMAKE_CXX_FLAGS} \
3232
/MP /W3 /bigobj \
33+
/wd4251 /wd4275 /wd4373 \
3334
/experimental:external /external:W0 "
3435
)
36+
# the warnings suppressed are:
37+
#
38+
# 4251 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2' Things from the
39+
# std library give these warnings and we can't do anything about them.
40+
#
41+
# 4275 Given that we are compiling everything with msvc under Windows and linking all with the same runtime we can
42+
# disable the warning about inheriting from a non-exported interface, e.g. std::runtime_error
43+
#
44+
# 4373 previous versions of the compiler did not override when parameters only differed by const/volatile qualifiers.
45+
# This is basically saying that it now follows the C++ standard and doesn't seem useful
3546

3647
# Set PCH heap limit, the default does not work when running msbuild from the commandline for some reason Any other
3748
# value lower or higher seems to work but not the default. It is fine without this when compiling in the GUI though...

0 commit comments

Comments
 (0)