Removed -Wno-unused-variable and fixed warnings.
Removed -Wno-tautological-compare and -Wno-invalid-offsetof
Warnings turned off for microsoft's code (we can't change it).
Adding -Wnarrowing, removing -Wno-null-conversion.
Ignoring GCC pragmas with Visual Studio.
Also all compiler settings moved from CMakeLists.txt to
compileoptions.cmake.
set(BUILD_MANAGED ON CACHE BOOL "Build managed part")
set(DBGSHIM_RUNTIME_DIR "" CACHE FILEPATH "Path to dbgshim library directory (at runtime)")
-if (WIN32)
- set(CMAKE_CXX_STANDARD 11)
-else()
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wno-null-conversion")
-endif()
-
function(clr_unknown_arch)
message(FATAL_ERROR "Only AMD64, ARM64, ARM, ARMEL, I386 and WASM are supported")
endfunction()
if (CLR_CMAKE_PLATFORM_UNIX)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+
# Disable frame pointer optimizations so profilers can get better call stacks
add_compile_options(-fno-omit-frame-pointer)
add_compile_options(-Werror)
endif(CLR_CMAKE_WARNINGS_ARE_ERRORS)
- # Disabled warnings
- add_compile_options(-Wno-unused-private-field)
- add_compile_options(-Wno-unused-variable)
# Explicit constructor calls are not supported by clang (this->ClassName::ClassName())
add_compile_options(-Wno-microsoft)
- # This warning is caused by comparing 'this' to NULL
- add_compile_options(-Wno-tautological-compare)
# There are constants of type BOOL used in a condition. But BOOL is defined as int
# and so the compiler thinks that there is a mistake.
add_compile_options(-Wno-constant-logical-operand)
add_compile_options(-Wno-unknown-warning-option)
- #These seem to indicate real issues
- add_compile_options(-Wno-invalid-offsetof)
# The following warning indicates that an attribute __attribute__((__ms_struct__)) was applied
# to a struct or a class that has virtual members or a base class. In that case, clang
# may not generate the same object layout as MSVC.
# Some architectures (e.g., ARM) assume char type is unsigned while CoreCLR assumes char is signed
# as x64 does. It has been causing issues in ARM (https://github.com/dotnet/coreclr/issues/4746)
add_compile_options(-fsigned-char)
+
+ add_compile_options(-Wall -Wextra -Walign-cast -Wstrict-aliasing -Wno-unused-parameter -Wnarrowing)
endif(CLR_CMAKE_PLATFORM_UNIX)
+
if(CLR_CMAKE_PLATFORM_UNIX_ARM AND NOT DEFINED CLR_CMAKE_TARGET_TIZEN_LINUX)
# Because we don't use CMAKE_C_COMPILER/CMAKE_CXX_COMPILER to use clang
# we have to set the triple by adding a compiler argument
if (WIN32)
# Compile options for targeting windows
+ set(CMAKE_CXX_STANDARD 11)
# The following options are set by the razzle build
add_compile_options(/TP) # compile all files as C++
add_compile_options(-D_MIDL_USE_GUIDDEF_)
file(GLOB CORGUIDS_SOURCES "${CORECLR_DIR}/src/pal/prebuilt/idl/*_i.cpp")
add_library(corguids STATIC ${CORGUIDS_SOURCES})
+if (NOT WIN32)
+ target_compile_options(corguids PRIVATE -Wno-unused-parameter)
+endif()
# Include coreclr headers
{
ss << ": {";
}
- HRESULT re = m_debugger->GetVariables(v.variablesReference, VariablesBoth, 0, v.namedVariables, children);
int count = 0;
for (auto &child : children)
{
#include <string>
#include <vector>
+
+#pragma warning (disable:4068) // Visual Studio should ignore GCC pragmas
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
#include <corerror.h>
+#pragma GCC diagnostic pop
#ifdef _MSC_VER
std::string to_utf8(const wchar_t *wstr);
// See the LICENSE file in the project root for more information.
#pragma once
+#pragma warning (disable:4068) // Visual Studio should ignore GCC pragmas
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
#include <cor.h>
#include <cordebug.h>
+#pragma GCC diagnostic pop
#include <vector>
BreakType IProtocol::GetBreakpointType(const std::vector<std::string> &args)
{
- int ncnt = 0;
+ unsigned ncnt = 0;
if (args.empty())
return BreakType::Error;
#ifdef FEATURE_PAL
exitCode = hook::waitpid.GetExitCode();
#else
+ HRESULT Status = S_OK;
HPROCESS hProcess;
DWORD dwExitCode = 0;
if (SUCCEEDED(pProcess->GetHandle(&hProcess)))
HRESULT MIProtocol::PrintVariables(const std::vector<Variable> &variables, std::string &output)
{
- const bool printValues = true;
- const bool printTypes = false;
-
std::ostringstream ss;
ss << "variables=[";
const char *sep = "";
if (n < 0)
return;
- if (n >= sizeof(buffer))
+ if (n >= int(sizeof(buffer)))
{
strbuffer.resize(n);
n = vsnprintf(&strbuffer[0], strbuffer.size() + 1, fmt, arg);
va_end(arg);
- if (n < 0 || n > strbuffer.size())
+ if (n < 0 || n > int(strbuffer.size()))
return;
out = strbuffer.c_str();
}
HRESULT Modules::FillSourcesCodeLinesForModule(IMetaDataImport *pMDImport, SymbolReader *symbolReader)
{
- HRESULT Status;
ULONG numTypedefs = 0;
HCORENUM fEnum = NULL;
mdTypeDef typeDef;
std::string fullPath = to_utf8(point.document);
#ifdef WIN32
+ HRESULT Status = S_OK;
std::string initialFullPath = fullPath;
IfFailRet(SymbolReader::StringToUpper(fullPath));
m_sourceCaseSensitiveFullPaths[fullPath] = initialFullPath;
#pragma once
+#pragma warning (disable:4068) // Visual Studio should ignore GCC pragmas
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
#include <cor.h>
+#pragma GCC diagnostic pop
+
#include <cordebug.h>
#include <functional>
// Walk the directory for each extension separately so that we first get files with .ni.dll extension,
// then files with .dll extension, etc.
- for (int extIndex = 0; extIndex < sizeof(tpaExtensions) / sizeof(tpaExtensions[0]); extIndex++)
+ for (size_t extIndex = 0; extIndex < sizeof(tpaExtensions) / sizeof(tpaExtensions[0]); extIndex++)
{
const char* ext = tpaExtensions[extIndex];
int extLength = strlen(ext);
HRESULT SymbolReader::ResolveSequencePoint(const char *filename, ULONG32 lineNumber, TADDR mod, mdMethodDef* pToken, ULONG32* pIlOffset)
{
- HRESULT Status = S_OK;
-
if (m_symbolReaderHandle != 0)
{
_ASSERTE(resolveSequencePointDelegate != nullptr);
ULONG64 ilOffset,
SequencePoint *sequencePoint)
{
- HRESULT Status = S_OK;
-
if (m_symbolReaderHandle != 0)
{
_ASSERTE(getSequencePointByILOffsetDelegate != nullptr);
HRESULT SymbolReader::GetStepRangesFromIP(ULONG32 ip, mdMethodDef MethodToken, ULONG32 *ilStartOffset, ULONG32 *ilEndOffset)
{
- HRESULT Status = S_OK;
-
if (m_symbolReaderHandle != 0)
{
_ASSERTE(getStepRangesFromIPDelegate != nullptr);
ULONG32* pIlStart,
ULONG32* pIlEnd)
{
- HRESULT Status = S_OK;
-
if (!m_symbolReaderHandle)
return E_FAIL;
HRESULT SymbolReader::GetSequencePoints(mdMethodDef methodToken, std::vector<SequencePoint> &points)
{
- HRESULT Status = S_OK;
-
if (m_symbolReaderHandle != 0)
{
_ASSERTE(getSequencePointsDelegate != nullptr);
// Copyright (c) 2017 Samsung Electronics Co., LTD
#pragma once
+#pragma warning (disable:4068) // Visual Studio should ignore GCC pragmas
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
#include <cor.h>
#include <cordebug.h>
+#pragma GCC diagnostic pop
#include <string>
#include <vector>
case ELEMENT_TYPE_VAR :
n = CorSigUncompressData(typePtr);
- out = n < args.size() ? args.at(n) : "!" + std::to_string(n);
+ out = n < int(args.size()) ? args.at(n) : "!" + std::to_string(n);
break;
case ELEMENT_TYPE_MVAR :
std::list<std::string> genericArgs;
unsigned numArgs = CorSigUncompressData(typePtr);
- bool needComma = false;
while(numArgs--)
{
std::string genType;
// See the LICENSE file in the project root for more information.
#pragma once
+#pragma warning (disable:4068) // Visual Studio should ignore GCC pragmas
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
#include <cor.h>
#include <cordebug.h>
+#pragma GCC diagnostic pop
#include <list>
#include <string>
//Now that we know the underlying enum type, let's decode the enum variable into OR-ed, human readable enum constants
fEnum = NULL;
- bool isFirst = true;
ULONG64 remainingValue = *((ULONG64*)enumValue);
while(SUCCEEDED(pMD->EnumFields(&fEnum, currentTypeDef, &fieldDef, 1, &numFields)) && numFields != 0)
{
// See the LICENSE file in the project root for more information.
#pragma once
+#pragma warning (disable:4068) // Visual Studio should ignore GCC pragmas
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
#include <cor.h>
#include <cordebug.h>
+#pragma GCC diagnostic pop
#include <string>
#include <string>
+#pragma warning (disable:4068) // Visual Studio should ignore GCC pragmas
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
#include <cor.h>
#include <cordebug.h>
+#pragma GCC diagnostic pop
+
#include "manageddebugger.h"
HRESULT WriteValue(
#include <exception>
+#pragma warning (disable:4068) // Visual Studio should ignore GCC pragmas
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
#include <winerror.h>
+#pragma GCC diagnostic pop
#include "vscodeprotocol.h"