diff options
author | Daniel Mensinger <daniel@mensinger-ka.de> | 2019-10-19 18:05:11 +0200 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2019-11-07 17:28:27 +0530 |
commit | d0ca05498fcceff45a4800f86c89ceca6d805a51 (patch) | |
tree | 5b003c18b3a6285515e89bbd0f17ba36afbed03d | |
parent | af27af78bb6356e9d64e6e608885b4d720c41118 (diff) | |
download | meson-d0ca05498fcceff45a4800f86c89ceca6d805a51.zip meson-d0ca05498fcceff45a4800f86c89ceca6d805a51.tar.gz meson-d0ca05498fcceff45a4800f86c89ceca6d805a51.tar.bz2 |
cmake: Blacklist more compiler warning flags
7 files changed, 80 insertions, 1 deletions
diff --git a/mesonbuild/cmake/interpreter.py b/mesonbuild/cmake/interpreter.py index f746f1a..92df462 100644 --- a/mesonbuild/cmake/interpreter.py +++ b/mesonbuild/cmake/interpreter.py @@ -82,7 +82,8 @@ target_type_requires_trace = ['INTERFACE_LIBRARY'] skip_targets = ['UTILITY'] blacklist_compiler_flags = [ - '/W1', '/W2', '/W3', '/W4', '/Wall', + '-Wall', '-Wextra', '-Weverything', '-Werror', '-Wpedantic', '-pedantic', '-w', + '/W1', '/W2', '/W3', '/W4', '/Wall', '/WX', '/w', '/O1', '/O2', '/Ob', '/Od', '/Og', '/Oi', '/Os', '/Ot', '/Ox', '/Oy', '/Ob0', '/RTC1', '/RTCc', '/RTCs', '/RTCu', '/Z7', '/Zi', '/ZI', diff --git a/test cases/cmake/13 system includes/main.cpp b/test cases/cmake/13 system includes/main.cpp new file mode 100644 index 0000000..315c0f7 --- /dev/null +++ b/test cases/cmake/13 system includes/main.cpp @@ -0,0 +1,10 @@ +#include <iostream> +#include <cmMod.hpp> + +using namespace std; + +int main() { + cmModClass obj("Hello"); + cout << obj.getStr() << endl; + return 0; +} diff --git a/test cases/cmake/13 system includes/meson.build b/test cases/cmake/13 system includes/meson.build new file mode 100644 index 0000000..db25a42 --- /dev/null +++ b/test cases/cmake/13 system includes/meson.build @@ -0,0 +1,14 @@ +project( + 'meson_cmake_system_include_bug', ['c', 'cpp'], + default_options: [ + 'warning_level=3', + #'werror=true', # TODO implement system includes + ], +) + +cm = import('cmake') +sub_pro = cm.subproject('cmMod') +sub_dep = sub_pro.dependency('cmModLib') + +exe1 = executable('main1', ['main.cpp'], dependencies: [sub_dep]) +test('test1', exe1) diff --git a/test cases/cmake/13 system includes/subprojects/cmMod/CMakeLists.txt b/test cases/cmake/13 system includes/subprojects/cmMod/CMakeLists.txt new file mode 100644 index 0000000..a6b0ba4 --- /dev/null +++ b/test cases/cmake/13 system includes/subprojects/cmMod/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.5) + +project(cmMod) +set (CMAKE_CXX_STANDARD 14) + +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + +add_definitions("-DDO_NOTHING_JUST_A_FLAG=1") + +add_library(cmModLib SHARED cmMod.cpp) +include(GenerateExportHeader) +generate_export_header(cmModLib) + +target_compile_options(cmModLib PRIVATE "-Wall" "-Werror") +target_include_directories(cmModLib SYSTEM PRIVATE "sysInc") diff --git a/test cases/cmake/13 system includes/subprojects/cmMod/cmMod.cpp b/test cases/cmake/13 system includes/subprojects/cmMod/cmMod.cpp new file mode 100644 index 0000000..1eaf0cf --- /dev/null +++ b/test cases/cmake/13 system includes/subprojects/cmMod/cmMod.cpp @@ -0,0 +1,12 @@ +#include "cmMod.hpp" +#include "triggerWarn.hpp" + +using namespace std; + +cmModClass::cmModClass(string foo) { + str = foo + " World " + to_string(bar(World)); +} + +string cmModClass::getStr() const { + return str; +} diff --git a/test cases/cmake/13 system includes/subprojects/cmMod/cmMod.hpp b/test cases/cmake/13 system includes/subprojects/cmMod/cmMod.hpp new file mode 100644 index 0000000..52f576b --- /dev/null +++ b/test cases/cmake/13 system includes/subprojects/cmMod/cmMod.hpp @@ -0,0 +1,13 @@ +#pragma once + +#include <string> +#include "cmmodlib_export.h" + +class CMMODLIB_EXPORT cmModClass { + private: + std::string str; + public: + cmModClass(std::string foo); + + std::string getStr() const; +}; diff --git a/test cases/cmake/13 system includes/subprojects/cmMod/sysInc/triggerWarn.hpp b/test cases/cmake/13 system includes/subprojects/cmMod/sysInc/triggerWarn.hpp new file mode 100644 index 0000000..3b00f2d --- /dev/null +++ b/test cases/cmake/13 system includes/subprojects/cmMod/sysInc/triggerWarn.hpp @@ -0,0 +1,14 @@ +#pragma once + +enum Foo { + Hello, + World +}; + +inline int bar( Foo foo ) { + switch(foo) { + case Hello: return 0; + // Warn because of missung case for World + } + return 1; +} |