microsoft / DirectXTK12

The DirectX Tool Kit (aka DirectXTK12) is a collection of helper classes for writing DirectX 12 code in C++
https://walbourn.github.io/directx-tool-kit-for-directx-12/
MIT License
1.47k stars 393 forks source link

Add CMake project and fix clang warnings #59

Closed walbourn closed 5 years ago

walbourn commented 5 years ago

With VS 2019 Update 1 supporting the clang/LLVM toolset, I've formally added CMake files as well as addressed a number of clang warnings.

walbourn commented 5 years ago

-Wc++98-compat -Wc++98-compat-pedantic -Wc++98-compat-local-type-template-args

Even though I have set the C++14 language standard, clang still complains about C++98 compat

-Wcovered-switch-default -Wswitch-enum

DXGI_FORMAT contains over a 100 enum values. Satisfying these warnings is pointless.

-Wfloat-equal

I get what this is after (i.e. use epsilon comparisions instead), but there are still cases where binary equality is just fine.

-Wgnu-anonymous-struct -Wnested-anon-types

Visual C++ and clang both support these, and without it makes a lot of our structs really tiresome to use.

-Wlanguage-extension-token

This is complaints about __uuidof which is often used inside the IID_(GRAPHICS_)PPV_ARGS macro. Again, Visual C++ and clang can use it.

-Wglobal-constructors -Wexit-time-destructors

This is a perf warning, and I don't care where it comes up.

-Wmissing-variable-declarations -Wunused-const-variable

This is about my use of __declspec(any) for DirectXMath vector constants.

-Wreserved-id-macro

The long-established control macros for DirectXMath trigger this due to the _XM_* format. Changing that would break existing clients, so I'll ignore this for now.

-Wtautological-type-limit-compare

This is coming up in a few contexts where I'm trying to handle bounds for size_t in x64 vs. x86. The optimizer should just deal.

-Wunknown-pragmas

This is mostly about #pragma prefast(suppress). Converting it to #ifdef __PREFAST__ push pop brackets is an option, but kind of wordy. I'm just supressingit for now.

walbourn commented 5 years ago

Fixed -Wmissing-prototypes in this commit