More GNUC Fixes (dotnet/coreclr#22687)
authorSinan Kaya <41809318+franksinankaya@users.noreply.github.com>
Fri, 22 Feb 2019 19:11:19 +0000 (14:11 -0500)
committerJan Vorlicek <janvorli@microsoft.com>
Fri, 22 Feb 2019 19:11:19 +0000 (20:11 +0100)
commit00f7964f86f5b4644c4dc4326cf639a3a8a9e84b
tree39e535d2fd19443ab739c2429d28cff1b516d763
parent7a09de3c0adca347886f0aa0ed91bed5f710c93d
More GNUC Fixes (dotnet/coreclr#22687)

* Replace __sync_swap with __atomic_exchange_n

__sync_swap() is a clang specific function.

* Remove multiline comment

* Add paranthesis around sum

src/md/hotdata/../inc/streamutil.h:73:34: warning: suggest parentheses around ‘+’ in operand of ‘&’ [-Wparentheses]
     UINT32 aligned = *totalBytes + 3 & ~3;

* Define __int64

* Define windows types for tests

* Remove undefined has_builtin defines and define alloca and inline for GNUC

* Remove __clang__ where possible

* Add implicit casting to help compiler find WCHAR* variant

src/binder/assembly.cpp:294:73: error: no matching function for call to ‘SString::SString(SString)’
         return (pAsmName == nullptr ? nullptr : pAsmName->GetSimpleName());
                                                                         ^
In file included from src/inc/sstring.h:1082:0,
                 from src/inc/ex.h:19,
                 from src/inc/stgpool.h:28,
                 from src/inc/../md/inc/metamodel.h:18,
                 from src/inc/../md/inc/metamodelro.h:19,
                 from src/inc/metadata.h:17,
                 from src/binder/../vm/util.hpp:19,
                 from src/binder/../vm/common.h:110,
                 from src/binder/assembly.cpp:14:
src/inc/sstring.inl:73:8: note: candidate: SString::SString(void*, COUNT_T)
 inline SString::SString(void *buffer, COUNT_T size)
        ^
src/inc/sstring.inl:73:8: note:   candidate expects 2 arguments, 1 provided
src/inc/sstring.inl:436:8: note: candidate: SString::SString(SString::tagLiteral, const WCHAR*, COUNT_T)
 inline SString::SString(tagLiteral dummytag, const WCHAR *literal, COUNT_T count)
        ^
src/inc/sstring.inl:436:8: note:   candidate expects 3 arguments, 1 provided
src/inc/sstring.inl:418:8: note: candidate: SString::SString(SString::tagLiteral, const WCHAR*)
 inline SString::SString(tagLiteral dummytag, const WCHAR *literal)
        ^
src/inc/sstring.inl:418:8: note:   candidate expects 2 arguments, 1 provided
src/inc/sstring.inl:401:8: note: candidate: SString::SString(SString::tagUTF8Literal, const UTF8*)
 inline SString::SString(tagUTF8Literal dummytag, const UTF8 *literal)
        ^
src/inc/sstring.inl:401:8: note:   candidate expects 2 arguments, 1 provided
src/inc/sstring.inl:382:8: note: candidate: SString::SString(SString::tagLiteral, const CHAR*)
 inline SString::SString(tagLiteral dummytag, const ASCII *literal)

* Reorder DLLEXPORT and STDAPI

GNUC wants extern "C" <attribute> format.

* Abstract __FUNCSIG__

* Abstract __debugbreak()

* Move common compiler options out of clang and add Wno-unused-value

* Add paranthesis around || and &&

src/gc/gc.cpp:9084:38: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
                     (!chosen_power2) && (i < free_space_count));

* Set Wno-delete-non-virtual-dtor for CXX files only

* Don't warn on unterminated endif labels

* Suppress unused functions

* Use 0x syntax rather than h syntax on GNU asm files

* Correct constructor call directly

src/ToolBox/superpmi/superpmi-shared/logging.cpp:301:27:   required from here
src/inc/clr_std/string:58:9: error: cannot call constructor ‘std::basic_string<char>::basic_string’ directly
         this->basic_string::basic_string(_Ptr, c_len(_Ptr));

* Suppress NULL used in arithmetic warnings

Commit migrated from https://github.com/dotnet/coreclr/commit/0495f7377fca88999d335757e9680052cfedc51d
37 files changed:
src/coreclr/configurecompiler.cmake
src/coreclr/src/ToolBox/SOS/Strike/CMakeLists.txt
src/coreclr/src/ToolBox/SOS/lldbplugin/CMakeLists.txt
src/coreclr/src/ToolBox/superpmi/superpmi-shared/standardpch.h
src/coreclr/src/binder/assembly.cpp
src/coreclr/src/debug/daccess/daccess.cpp
src/coreclr/src/debug/daccess/nidump.cpp
src/coreclr/src/debug/ee/amd64/dbghelpers.S
src/coreclr/src/dlls/mscordbi/mscordbi.cpp
src/coreclr/src/dlls/mscoree/mscoree.cpp
src/coreclr/src/dlls/mscorpe/CMakeLists.txt
src/coreclr/src/gc/env/gcenv.base.h
src/coreclr/src/gc/env/gcenv.interlocked.inl
src/coreclr/src/gc/gc.cpp
src/coreclr/src/gc/gcpriv.h
src/coreclr/src/ilasm/CMakeLists.txt
src/coreclr/src/inc/CMakeLists.txt
src/coreclr/src/inc/clr_std/string
src/coreclr/src/jit/compiler.cpp
src/coreclr/src/jit/jit.h
src/coreclr/src/md/inc/streamutil.h
src/coreclr/src/unwinder/arm64/unwinder_arm64.cpp
src/coreclr/src/vm/rejit.inl
src/coreclr/tests/src/Common/Platform/platformdefines.h
src/coreclr/tests/src/Interop/ArrayMarshalling/ByValArray/MarshalArrayByValNative.cpp
src/coreclr/tests/src/Interop/PInvoke/Array/MarshalArray.h
src/coreclr/tests/src/Interop/PInvoke/Array/MarshalArrayAsField/LPArrayNative/MarshalArrayByValArrayNative.cpp
src/coreclr/tests/src/Interop/PInvoke/Array/MarshalArrayAsParam/LPArrayNative/MarshalArrayLPArrayNative.cpp
src/coreclr/tests/src/JIT/Directed/StructABI/StructABI.c
src/coreclr/tests/src/JIT/Directed/arglist/varargnative.c
src/coreclr/tests/src/JIT/Directed/pinning/object-pin/mirror.cpp
src/coreclr/tests/src/JIT/Methodical/structs/systemvbringup/structinregs.cpp
src/coreclr/tests/src/JIT/SIMD/Vector3TestNative.cpp
src/coreclr/tests/src/JIT/jit64/hfa/main/dll/hfa_native.cpp
src/coreclr/tests/src/JIT/jit64/hfa/main/dll/hfa_native.h
src/coreclr/tests/src/JIT/jit64/mcc/interop/native.h
src/coreclr/tests/src/Loader/NativeLibs/FromNativePaths_lib.cpp