Skip to content

Commit

Permalink
Replaced compiler option to disabled all warnings in Linux build by o…
Browse files Browse the repository at this point in the history
…ptions for explicit disabling of specific warnings.

Fixed warnings that were not possible to disable (those that have no identifier) and few other trivial ones.
We will need to revisit the warnings fix as many as we reasonably can.

[tfs-changeset: 1408205]
  • Loading branch information
janvorli committed Jan 31, 2015
1 parent e80a41a commit cb37735
Show file tree
Hide file tree
Showing 17 changed files with 69 additions and 44 deletions.
42 changes: 38 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,44 @@ add_definitions(-DDISABLE_CONTRACTS)
# The -ferror-limit is helpful during the porting, it makes sure the compiler doesn't stop
# after hitting just about 20 errors.
add_compile_options(-ferror-limit=4096)
# The -w option disables warnings for now, there are hundreds of them and it is hard to
# find the errors in the output. We need to reenable them later though to make sure we don't`
# miss any real issues.
add_compile_options(-w)

# Disabled warnings
add_compile_options(-Wno-reorder)
add_compile_options(-Wno-ignored-attributes)
add_compile_options(-Wno-unknown-pragmas)
add_compile_options(-Wno-unused-private-field)
add_compile_options(-Wno-new-returns-null)
add_compile_options(-Wno-dangling-else)
add_compile_options(-Wno-implicit-exception-spec-mismatch)
add_compile_options(-Wno-deprecated-register)
add_compile_options(-Wno-parentheses)
add_compile_options(-Wno-overloaded-virtual)
add_compile_options(-Wno-unused-variable)
add_compile_options(-Wno-missing-declarations)
add_compile_options(-Wno-switch)
add_compile_options(-Wno-extern-initializer)
add_compile_options(-Wno-microsoft)
add_compile_options(-Wno-mismatched-tags)
add_compile_options(-Wno-ignored-qualifiers)
add_compile_options(-Wno-tautological-constant-out-of-range-compare)
add_compile_options(-Wno-c++11-compat-deprecated-writable-strings)
add_compile_options(-Wno-unneeded-internal-declaration)
add_compile_options(-Wno-tautological-compare)
add_compile_options(-Wno-constant-logical-operand)
add_compile_options(-Wno-unused-function)
add_compile_options(-Wno-extra-tokens)
add_compile_options(-Wno-self-assign)
add_compile_options(-Wno-bitfield-constant-conversion)
add_compile_options(-Wno-unused-value)

#These seem to indicate real issues
add_compile_options(-Wno-invalid-offsetof)
add_compile_options(-Wno-return-type)
add_compile_options(-Wno-dynamic-class-memaccess)
add_compile_options(-Wno-int-to-pointer-cast)
add_compile_options(-Wno-delete-non-virtual-dtor)
add_compile_options(-Wno-enum-compare)

# The -fms-extensions enable the stuff like __if_exists, __declspec(uuid()), etc.
add_compile_options(-fms-extensions )
#-fms-compatibility Enable full Microsoft Visual C++ compatibility
Expand Down
2 changes: 1 addition & 1 deletion src/debug/ee/debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10765,7 +10765,7 @@ bool Debugger::HandleIPCEvent(DebuggerIPCEvent * pEvent)
// If we need to fault, let's generate an access violation.
if (s_fDbgFaultInHandleIPCEvent)
{
*((BYTE *)0) = 0;
*((volatile BYTE *)0) = 0;
}
#endif

Expand Down
16 changes: 8 additions & 8 deletions src/gc/gc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5796,7 +5796,7 @@ inline
BOOL grow_mark_stack (mark*& m, size_t& len, size_t init_len)
{
size_t new_size = max (init_len, 2*len);
mark* tmp = new (nothrow) (mark [new_size]);
mark* tmp = new (nothrow) mark [new_size];
if (tmp)
{
memcpy (tmp, m, len * sizeof (mark));
Expand Down Expand Up @@ -8125,7 +8125,7 @@ class seg_free_spaces
MAX_NUM_BUCKETS * sizeof (free_space_bucket) +
MAX_NUM_FREE_SPACES * sizeof (seg_free_space);

free_space_buckets = (free_space_bucket*) new (nothrow) (BYTE[total_prealloc_size]);
free_space_buckets = (free_space_bucket*) new (nothrow) BYTE[total_prealloc_size];

return (!!free_space_buckets);
}
Expand Down Expand Up @@ -16810,7 +16810,7 @@ gc_heap::ha_mark_object_simple (BYTE** po THREAD_NUMBER_DCL)
{
if (!internal_root_array)
{
internal_root_array = new (nothrow) (BYTE* [internal_root_array_length]);
internal_root_array = new (nothrow) BYTE* [internal_root_array_length];
if (!internal_root_array)
{
heap_analyze_success = FALSE;
Expand All @@ -16829,7 +16829,7 @@ gc_heap::ha_mark_object_simple (BYTE** po THREAD_NUMBER_DCL)
}
else
{
BYTE** tmp = new (nothrow) (BYTE* [new_size]);
BYTE** tmp = new (nothrow) BYTE* [new_size];
if (tmp)
{
memcpy (tmp, internal_root_array,
Expand Down Expand Up @@ -17715,7 +17715,7 @@ BOOL gc_heap::background_process_mark_overflow (BOOL concurrent_p)
{
dprintf (2, ("h%d: ov grow to %Id", heap_number, new_size));

BYTE** tmp = new (nothrow) (BYTE* [new_size]);
BYTE** tmp = new (nothrow) BYTE* [new_size];
if (tmp)
{
delete background_mark_stack_array;
Expand Down Expand Up @@ -17821,7 +17821,7 @@ BOOL gc_heap::process_mark_overflow(int condemned_gen_number)
if ((mark_stack_array_length < new_size) &&
((new_size - mark_stack_array_length) > (mark_stack_array_length / 2)))
{
mark* tmp = new (nothrow) (mark [new_size]);
mark* tmp = new (nothrow) mark [new_size];
if (tmp)
{
delete mark_stack_array;
Expand Down Expand Up @@ -25135,7 +25135,7 @@ void gc_heap::background_grow_c_mark_list()
}
else
{
new_c_mark_list = new (nothrow) (BYTE*[c_mark_list_length*2]);
new_c_mark_list = new (nothrow) BYTE*[c_mark_list_length*2];
if (new_c_mark_list == 0)
{
should_drain_p = TRUE;
Expand Down Expand Up @@ -35084,7 +35084,7 @@ CFinalize::GrowArray()
size_t oldArraySize = (m_EndArray - m_Array);
size_t newArraySize = (size_t)(((float)oldArraySize / 10) * 12);

Object** newArray = new (nothrow)(Object*[newArraySize]);
Object** newArray = new (nothrow) Object*[newArraySize];
if (!newArray)
{
// It's not safe to throw here, because of the FinalizeLock. Tell our caller
Expand Down
2 changes: 1 addition & 1 deletion src/inc/arraylist.h
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ class StructArrayList : public StructArrayListBase
class ItemIterator
{

typedef typename StructArrayList<ELEMENT_TYPE, INITIAL_CHUNK_LENGTH, CHUNK_LENGTH_GROWTH_FACTOR, ALLOCATOR>
typedef StructArrayList<ELEMENT_TYPE, INITIAL_CHUNK_LENGTH, CHUNK_LENGTH_GROWTH_FACTOR, ALLOCATOR>
SAList;

typedef typename StructArrayList<ELEMENT_TYPE, INITIAL_CHUNK_LENGTH, CHUNK_LENGTH_GROWTH_FACTOR, ALLOCATOR>::ArrayIterator
Expand Down
2 changes: 1 addition & 1 deletion src/inc/complex.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Complex
double r;
double i;

Complex() : r(0), i(i) {}
Complex() : r(0), i(0) {}
Complex(double real) : r(real), i(0) {}
Complex(double real, double imag) : r(real), i(imag) {}
Complex(const Complex& other) : r(other.r), i(other.i) {}
Expand Down
2 changes: 1 addition & 1 deletion src/md/enc/metamodelrw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3511,7 +3511,7 @@ CMiniMdRW::SaveFullTablesToStream(
// For each table...
for (ixTbl=0; ixTbl<m_TblCount; ++ixTbl)
{
headerOffset[ixTbl] = ~0UL;
headerOffset[ixTbl] = ~0U;

ULONG itemCount = GetCountRecs(ixTbl);
if (itemCount)
Expand Down
3 changes: 1 addition & 2 deletions src/pal/inc/pal.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ extern "C" {
#endif // !_MSC_VER


#ifdef _MSC_VER
#if defined(_MSC_VER) || defined(__llvm__)
#define DECLSPEC_ALIGN(x) __declspec(align(x))
#else
#define DECLSPEC_ALIGN(x)
Expand Down Expand Up @@ -6169,7 +6169,6 @@ PAL_CppRethrow();
#define DBG_TERMINATE_THREAD ((DWORD )0x40010003L)
#define DBG_TERMINATE_PROCESS ((DWORD )0x40010004L)
#define DBG_CONTROL_C ((DWORD )0x40010005L)
#define DBG_PRINTEXCEPTION_C ((DWORD )0x40010006L)
#define DBG_RIPEXCEPTION ((DWORD )0x40010007L)
#define DBG_CONTROL_BREAK ((DWORD )0x40010008L)
#define DBG_COMMAND_EXCEPTION ((DWORD )0x40010009L)
Expand Down
2 changes: 2 additions & 0 deletions src/pal/inc/pal_char16.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ typedef char16_t wchar_t;
typedef unsigned short wchar_t;
#endif // __cplusplus
#endif // PLATFORM_UNIX
#ifndef _WCHAR_T_DEFINED
#define _WCHAR_T_DEFINED
#endif // !_WCHAR_T_DEFINED
#endif // !_WCHAR_T_DEFINED || !_MSC_VER

4 changes: 2 additions & 2 deletions src/vm/amd64/unixstubs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ extern "C"
" mov %%ebx, 4(%[result])\n" \
" mov %%ecx, 8(%[result])\n" \
" mov %%edx, 12(%[result])\n" \
: "=a"(eax) /*output in eax*/\
: "=a"(eax) /*output in eax*/\
: "a"(arg), [result]"r"(result) /*inputs - arg in eax, result in any register*/\
: "eax", "rbx", "ecx", "edx" /* registers that are clobbered*/
);
Expand All @@ -115,7 +115,7 @@ extern "C"
" mov %%ebx, 4(%[result])\n" \
" mov %%ecx, 8(%[result])\n" \
" mov %%edx, 12(%[result])\n" \
: "=a"(eax) /*output in eax*/\
: "=a"(eax) /*output in eax*/\
: "c"(arg1), "a"(arg2), [result]"r"(result) /*inputs - arg1 in ecx, arg2 in eax, result in any register*/\
: "eax", "rbx", "ecx", "edx" /* registers that are clobbered*/
);
Expand Down
2 changes: 1 addition & 1 deletion src/vm/amd64/virtualcallstubcpu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ void ResolveHolder::InitializeStatic()
#pragma warning(disable:4305 4309)
#endif // defined(_MSC_VER)

resolveInit._hashedToken = 0xcccccccccccccccc;
resolveInit._hashedToken = 0xcccccccc;

#if defined(_MSC_VER)
#pragma warning(pop)
Expand Down
2 changes: 1 addition & 1 deletion src/vm/corhost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7830,7 +7830,7 @@ void CExecutionEngine::SetupTLSForThread(Thread *pThread)
pThread->AddFiberInfo(Thread::ThreadTrackInfo_Lifetime);
#endif
#ifdef STRESS_LOG
if (StressLog::StressLogOn(~0ul, 0))
if (StressLog::StressLogOn(~0u, 0))
{
StressLog::CreateThreadStressLog();
}
Expand Down
4 changes: 3 additions & 1 deletion src/vm/exceptionhandling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ static ExceptionTracker* GetTrackerMemory()
return g_theTrackerAllocator.GetTrackerMemory();
}

static void FreeTrackerMemory(ExceptionTracker* pTracker, TrackerMemoryType mem)
void FreeTrackerMemory(ExceptionTracker* pTracker, TrackerMemoryType mem)
{
CONTRACTL
{
Expand Down Expand Up @@ -380,8 +380,10 @@ void ExceptionTracker::UpdateNonvolatileRegisters(CONTEXT *pContextRecord, REGDI

UPDATEREG(Rbx);
UPDATEREG(Rbp);
#ifndef UNIX_AMD64_ABI
UPDATEREG(Rsi);
UPDATEREG(Rdi);
#endif
UPDATEREG(R12);
UPDATEREG(R13);
UPDATEREG(R14);
Expand Down
6 changes: 3 additions & 3 deletions src/vm/gcstress.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,10 @@ namespace _GCStress
{
// no definition provided so that absence of concrete implementations cause compiler errors
template <enum gcs_trigger_points>
static bool IsEnabled();
bool IsEnabled();

template<> FORCEINLINE
static bool IsEnabled<cfg_any>()
bool IsEnabled<cfg_any>()
{
// Most correct would be to test for each specific bits, but we've
// always only tested against 0...
Expand All @@ -203,7 +203,7 @@ namespace _GCStress

#define DefineIsEnabled(cfg_enum, eeconfig_bits) \
template<> FORCEINLINE \
static bool IsEnabled<cfg_enum>() \
bool IsEnabled<cfg_enum>() \
{ \
return (g_pConfig->GetGCStressLevel() & (eeconfig_bits)) != 0; \
}
Expand Down
7 changes: 1 addition & 6 deletions src/vm/methodtable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4451,9 +4451,6 @@ VOID DoAccessibilityCheckForConstraints(MethodTable *pAskingMT, TypeVarTypeDesc
// walked. Note that it would be just as correct to always defer to the pending list -
// however, that is a little less performant.
//
// pInstContext - instantiation context created in code:SigPointer.GetTypeHandleThrowing and
// ultimately passed down to code:TypeVarTypeDesc.SatisfiesConstraints.
//


// Closure of locals necessary for implementing CheckForEquivalenceAndFullyLoadType.
Expand All @@ -4463,7 +4460,6 @@ struct DoFullyLoadLocals
DoFullyLoadLocals(DFLPendingList *pPendingParam, ClassLoadLevel levelParam, MethodTable *pMT, Generics::RecursionGraph *pVisited) :
newVisited(pVisited, TypeHandle(pMT)),
pPending(pPendingParam),
pInstContext(pInstContext),
level(levelParam),
fBailed(FALSE)
#ifdef FEATURE_COMINTEROP
Expand All @@ -4477,7 +4473,6 @@ struct DoFullyLoadLocals

Generics::RecursionGraph newVisited;
DFLPendingList * const pPending;
const InstantiationContext * const pInstContext;
const ClassLoadLevel level;
BOOL fBailed;
#ifdef FEATURE_COMINTEROP
Expand Down Expand Up @@ -4507,7 +4502,7 @@ static void CheckForEquivalenceAndFullyLoadType(Module *pModule, mdToken token,
TypeHandle th = sigPtr.GetTypeHandleThrowing(pModule, pTypeContext, ClassLoader::LoadTypes, (ClassLoadLevel)(pLocals->level - 1));
CONSISTENCY_CHECK(!th.IsNull());

th.DoFullyLoad(&pLocals->newVisited, pLocals->level, pLocals->pPending, &pLocals->fBailed, pLocals->pInstContext);
th.DoFullyLoad(&pLocals->newVisited, pLocals->level, pLocals->pPending, &pLocals->fBailed, NULL);
pLocals->fDependsOnEquivalentOrForwardedStructs = TRUE;
pLocals->fHasEquivalentStructParameter = TRUE;
}
Expand Down
7 changes: 0 additions & 7 deletions src/vm/multicorejit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,6 @@ bool MulticoreJitManager::IsLoadOkay(Module * pModule)
#endif


// #define MCGEN_ENABLE_CHECK(Context, Descriptor) (Context.IsEnabled && McGenEventTracingEnabled(&Context, &Descriptor))

// #define FireEtwMulticoreJit(ClrInstanceID, String1, String2, Int1, Int2, Int3)\
// MCGEN_ENABLE_CHECK(MICROSOFT_WINDOWS_DOTNETRUNTIME_PRIVATE_PROVIDER_Context, MulticoreJit) ?\
// CoMofTemplate_hzzddd(Microsoft_Windows_DotNETRuntimePrivateHandle, &MulticoreJit, &CLRMulticoreJitId, ClrInstanceID, String1, String2, Int1, Int2, Int3)\
// : ERROR_SUCCESS\

void MulticoreJitFireEtw(const wchar_t * pAction, const wchar_t * pTarget, int p1, int p2, int p3)
{
LIMITED_METHOD_CONTRACT
Expand Down
4 changes: 2 additions & 2 deletions src/vm/syncblk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1129,8 +1129,8 @@ void SyncBlockCache::Grow()
COMPlusThrowOM();
}

newSyncTable = new(SyncTableEntry[newSyncTableSize]);
newBitMap = new(DWORD[BitMapSize (newSyncTableSize)]);
newSyncTable = new SyncTableEntry[newSyncTableSize];
newBitMap = new DWORD[BitMapSize (newSyncTableSize)];


{
Expand Down
6 changes: 3 additions & 3 deletions src/vm/threadsuspend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1098,7 +1098,7 @@ BOOL Thread::IsExecutingWithinCer()
pThread->StackWalkFrames(TAStackCrawlCallBack, &sContext);

#ifdef STRESS_LOG
if (sContext.fWithinCer && StressLog::StressLogOn(~0ul, 0))
if (sContext.fWithinCer && StressLog::StressLogOn(~0u, 0))
{
// If stress log is on, write info to stress log
StackCrawlContext sContext1 = { pThread,
Expand Down Expand Up @@ -1459,7 +1459,7 @@ BOOL Thread::ReadyForAsyncException(ThreadInterruptMode mode)

#ifdef STRESS_LOG
REGDISPLAY rd1;
if (StressLog::StressLogOn(~0ul, 0))
if (StressLog::StressLogOn(~0u, 0))
{
CONTEXT ctx1;
CopyRegDisplay(&rd, &rd1, &ctx1);
Expand Down Expand Up @@ -1494,7 +1494,7 @@ BOOL Thread::ReadyForAsyncException(ThreadInterruptMode mode)
}

#ifdef STRESS_LOG
if (StressLog::StressLogOn(~0ul, 0) &&
if (StressLog::StressLogOn(~0u, 0) &&
(IsRudeAbort() || !TAContext.fWithinEHClause))
{
//Save into stresslog.
Expand Down

0 comments on commit cb37735

Please sign in to comment.