Skip to content

Commit

Permalink
Fixing warnings and adding warnings to the local build
Browse files Browse the repository at this point in the history
  • Loading branch information
VeithMetro committed Aug 22, 2023
1 parent e3e3411 commit c06ab39
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 8 deletions.
22 changes: 22 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,27 @@ if (BUILD_REFERENCE)
add_definitions (-DBUILD_REFERENCE=${BUILD_REFERENCE})
endif()

option(ENABLE_STRICT_COMPILER_SETTINGS
"Enable compiler flags to get the warnings/errors due to improper condition in the code" ON)

if(ENABLE_STRICT_COMPILER_SETTINGS)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
message(FATAL_ERROR "Compiling with Clang")
set(CMAKE_STRICT_COMPILER_SETTINGS "-Weverything -Wextra -Wpedantic -Werror")
set(CMAKE_STRICT_CXX_COMPILER_SETTINGS "${CMAKE_STRICT_COMPILER_SETTINGS} -Wnon-virtual-dtor")
elseif(${CMAKE_COMPILER_IS_GNUCXX})
message(STATUS "Compiling with GCC")
set(CMAKE_STRICT_COMPILER_SETTINGS "-Wall -Wextra -Wpedantic -Werror")
set(CMAKE_STRICT_CXX_COMPILER_SETTINGS "${CMAKE_STRICT_COMPILER_SETTINGS} -Wnon-virtual-dtor")
elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
message(STATUS "Compiling with MS Visual Studio")
set(CMAKE_STRICT_COMPILER_SETTINGS "/W4")
else()
message(STATUS "Compiler ${CMAKE_CXX_COMPILER_ID}")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_STRICT_CXX_COMPILER_SETTINGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_STRICT_COMPILER_SETTINGS}")
endif()

add_subdirectory(interfaces)
add_subdirectory(definitions)
2 changes: 1 addition & 1 deletion definitions/Definitions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
#include "ValuePoint.h"
#endif

MODULE_NAME_DECLARATION(BUILD_REFERENCE);
MODULE_NAME_DECLARATION(BUILD_REFERENCE)

namespace WPEFramework {

Expand Down
12 changes: 6 additions & 6 deletions definitions/definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@

namespace WPEFramework {

ENUM_CONVERSION_HANDLER(Exchange::IComposition::ScreenResolution);
ENUM_CONVERSION_HANDLER(Exchange::IStream::streamtype);
ENUM_CONVERSION_HANDLER(Exchange::IStream::state);
ENUM_CONVERSION_HANDLER(Exchange::IValuePoint::basic);
ENUM_CONVERSION_HANDLER(Exchange::IValuePoint::specific);
ENUM_CONVERSION_HANDLER(Exchange::IValuePoint::dimension);
ENUM_CONVERSION_HANDLER(Exchange::IComposition::ScreenResolution)
ENUM_CONVERSION_HANDLER(Exchange::IStream::streamtype)
ENUM_CONVERSION_HANDLER(Exchange::IStream::state)
ENUM_CONVERSION_HANDLER(Exchange::IValuePoint::basic)
ENUM_CONVERSION_HANDLER(Exchange::IValuePoint::specific)
ENUM_CONVERSION_HANDLER(Exchange::IValuePoint::dimension)
}
2 changes: 1 addition & 1 deletion interfaces/json/ExternalMetadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,5 @@ namespace WPEFramework {
}
}

ENUM_CONVERSION_HANDLER(Exchange::External::Metadata::protocol);
ENUM_CONVERSION_HANDLER(Exchange::External::Metadata::protocol)
}

0 comments on commit c06ab39

Please sign in to comment.