Skip to content

[linux-port] Fix anonymous struct warnings - #1329

Merged
Ehsan (ehsannas) merged 1 commit into
microsoft:masterfrom
pow2clk:p2cms-anonstruct
May 31, 2018
Merged

Ehsan (ehsannas) merged 1 commit into
microsoft:masterfrom
pow2clk:p2cms-anonstruct

Conversation

@pow2clk

Copy link
Copy Markdown
Collaborator

A most pervasive warning from a minimal amount of code. The Wintypes
header included an anonymous struct in the form of LARGE_INTEGER
which is specified by Microsoft, but the actual MS header includes
another struct in the union for environments that don't want
anonymous structs. Given the minimal usage, I think this can
qualify. Microsoft's own headers will exclude the anonymous struct
in favor of the named one if NONAMELESSSTRUCT is defined before
windows.h. To prevent future uses of the anonymous part of LARGE_
INTEGER, this defines that in WinIncludes.h.
Fixes 148 clang and 148 gcc warnings.

A most pervasive warning from a minimal amount of code. The Wintypes
header included an anonymous struct in the form of LARGE_INTEGER
which is specified by Microsoft, but the actual MS header includes
another struct in the union for environments that don't want
anonymous structs. Given the minimal usage, I think this can
qualify. Microsoft's own headers will exclude the anonymous struct
in favor of the named one if NONAMELESSSTRUCT is defined before
windows.h. To prevent future uses of the anonymous part of LARGE_
INTEGER, this defines that in WinIncludes.h.
Fixes 148 clang and 148 gcc warnings.
@AppVeyorBot

Copy link
Copy Markdown

@ehsannas Ehsan (ehsannas) added enhancement Feature suggestion linux Linux-specific work labels May 31, 2018
@ehsannas

Copy link
Copy Markdown
Contributor

LGTM. Thanks.

@ehsannas

Copy link
Copy Markdown
Contributor

Thanks, Marcelo Lopez Ruiz (@marcelolr)

@ehsannas
Ehsan (ehsannas) merged commit 8ccd639 into microsoft:master May 31, 2018
@pow2clk
Gregory Roth (pow2clk) deleted the p2cms-anonstruct branch June 6, 2018 08:30
Ehsan (ehsannas) added a commit to google/DirectXShaderCompiler that referenced this pull request Jun 18, 2018
* [spirv] None (0x0) is an invalid Image Operand. (microsoft#1311)

* [linux-port] Update CMake files. prepare for Linux. (microsoft#1312)

This CL makes changes to CMake files in order to:
1- disable things that are not supported on non-Windows platforms.
2- make cross-platform compilation possible.

It also brings back LLVM's config.guess (mirrors:
https://github.com/llvm-mirror/llvm/blob/master/cmake/config.guess)

* [linux-port] More compile improvement (helps GCC). (microsoft#1310)

GCC has what seems to me to be a bug where it disapproves of the members
of a member struct of class OP having the same name as a type imported
by "using". It's the only compiler with the issue and I don't see any real
conflict, but it's easier to placate it than to fix GCC. GCC
claims its ambiguous. Making the member variables lowercase fixes
this neatly.

Removed some PointerStatus:: prefixes from references within the
class itself which upsets GCC.

HLSL changes excluded Transforms/Instrumentation directory entirely
including BoundsChecking. However it didn't excluder one reference
to a function declared there in BackendUtil that fails to link on GCC.
The function that references the missing BoundsChecking function
is static and not used anywhere with current settings. So it's not
considered a symbol to be linked by MSVC or clang, but GCC insists.

* [linux-port] Remove extra semicolons (microsoft#1317)

Terminating classes may create a muscle memory for typing a
semicolon after a left-justified closed brace. Whatever the reason
to GCC's chagrine there were many functions ended with unnecessary
semicolons. Each one caused a warning. This removes them.

Fixes 285 GCC warnings

* [linux-port] Scalar initialization warnings (microsoft#1316)

There is the possibility of a few variables being used without
initialization, which causes some warnings.
Fixes 2 clang warnings

GCC worries that assigning a variable to the result of an
assignment of that same variable may be undefined. It's a silly
thing to do anyway. So it's removed.
Fixes 1 gcc warning.

GCC is quite sure that Interp is too small to hold values of up
to 9 with only 4 bits. Perhaps because the RHS is a variable of
8 bits.
Fixes 47 gcc warnings

* [linux-port] Mark all overridden methods (microsoft#1319)

Clang produces a warning when a method that overrides another is
not marked with the override keyword. Adding the keyword has no
effect on overridden functions, but it is good practice to mark
all methods intended to override as such because if they fail to
do so, the keyword will produce an error.

Fixes 78 Clang warnings.

* [linux-port] Fix preprocessor warnings (microsoft#1323)

Remove pragma once from source files. It has no meaning in a source
file unless it's used as a header, which, fortunately, none of
these are.
Fixes 3 clang and 3 gcc warnings.

Remove trailing tokens after #endifs. Common result from copy,
paste, and slightly alter the beginning #if line to keep the
comments after consistent.
Fixes 3 clang and 3 gcc warnings.

* [linux-port] Correct const casts (microsoft#1324)

There are a lot of cases where const is carelessly cast off. Some
of them lead to really dramatic changes in multiple interfaces to
fix properly. This is instead a subset of cases where const was
disrespected, often for no apparent reason at all. likely just a
mistake in type casting.

Fixes 88 gcc and 88 clang warnings.

* use prettyxml to generate ShaderOpArithTable.xml (microsoft#1192)

* [linux-port] Fix anonymous struct warnings (microsoft#1329)

A most pervasive warning from a minimal amount of code. The Wintypes
header included an anonymous struct in the form of LARGE_INTEGER
which is specified by Microsoft, but the actual MS header includes
another struct in the union for environments that don't want
anonymous structs. Given the minimal usage, I think this can
qualify. Microsoft's own headers will exclude the anonymous struct
in favor of the named one if NONAMELESSSTRUCT is defined before
windows.h. To prevent future uses of the anonymous part of LARGE_
INTEGER, this defines that in WinIncludes.h.
Fixes 148 clang and 148 gcc warnings.

* [linux-port] Fix warnings from lambda functions (microsoft#1320)

Various lambda functions included captured variables that they
didn't actually use. This produces a warning on clang.
Fixes 6 clang warnings.

* [linux-port] Fix DXASSERT warnings (microsoft#1322)

The various DXASSERT macros produced a number of different warnings.
The most obvious was providing an empty string for a macro expecting
a message. Substituting in the _NOMSG macro fixes this.
Fixes 13 clang warnings.

A trickier problem for GCC and Clang is a variadic macro that is
provided no variadic arguments. Both Clang and GCC will avoid
errors by using the ##__VA_ARGS__ non-standard behavior, but it's
not an ideal solution. It turns out there aren't that many DXASSERT
macros that actually take variadic arguments. So I added an _ARGS
variant and replaced those instances with that. An ancillary benefit
is that non variadic asserts can present a message with the assert.
Fixes 583 clang warnings and 582 gcc warnings.

In what I expect was an earlier attempt to overload the DXASSERT
macro, it was defined twice each time with a different number of args.
Sadly, macros can't be overloaded, so this just produced more errors.
Fixes 69 clang warnings and 69 gcc warnings.

Finally, I removed the user declaration of std::error_code because
it is defined in a standard header <system_error>. Because clang was
including that header some places, it saw it as a redefinition. But
the Linux version is a struct and windows is a class. So nothing we
put here can make everyone happy. It doesn't really fit with this
change except for in proximity but doesn't fit anywhere else either.
Fixes 52 clang warnings

* [spirv] Update SPIR-V Tools. (microsoft#1334)

* [linux-port] Remove/dummy unused class components (microsoft#1333)

Clang is smart enough to detect when a class member function or
variable is not used and emits a warning for that case. This
removes all such members as well as any corresponding parameters
and other variables that might have been used to initialize such.
Fixes 8 clang warnings.

NotOptimized in DxilGenerationPass echoed in places that made us
think that it might be needed at some point in spite of not being
used now. So it gets a dummy reference instead of being removed.

* [linux-port] Dummy access to unused variables (microsoft#1325)

Simply including a variable as the entirity of an expression is
insufficient to silence warnings for gcc and clang. The variable
is not reported as unused, which is the intent, but the expression
result is reported in a warning as unused. By casting that
expression as (void), both warnings are silenced.
Fixes 110 clang and 40 gcc warnings.

* [linux-port] Fix spirv test warnings (microsoft#1337)

clang-spirv-tests uses a lot of external projects that keep
themselves clean with different standards of warnings flags.
This alters the appropriate cmake files to disable flags that
the DXC build enables.
Fixes 72 gcc and 166 clang warnings.

Additionally catch some sign mismatch comparisons in tests
built as part of clang-spirv-tests.
Fixes 2 gcc and 2 clang warnings, but one of them has multiple sources
So it's kind of a lot more.

* [linux-port] Correct conditional groupings (microsoft#1326)

Clang and gcc complain when AND and OR logical operations are both
used in a single conditional because of the possibility of mistakes
when depending solely on operator precedence. In fact, this change
fixes a few clear errors mostly in asserts that would never fire.
Fixes 13 clang and 22 gcc warnings.

Additionally, when two if statements are followed by an else, there
may be some ambiguity in terms of which if the else applies to. It
is the closest one, the second in the case of two, but it is another
area of potential mistakes. Adding braces around the code intended
as the block of the first if conditional clarifies this.
fixed 8 clang and 8 gcc warnings.

Clang complains sometimes when assignments take place in a
conditional without additional parenthesis around it. It can
indicate when what was meant to be an equal comparison is replaced
with an assignment.
fixes 2 clang warnings.

* [linux-port] Unused variables in conditionals (microsoft#1336)

A surprising number of if statements declare variables in their
parentheses. Usually, these variables are used afterward. When they
are not, gcc produces a warning. clang does not.
Fixes gcc warnings.

* [linux-port] disable covered-switch-default warning (microsoft#1332)

Defaults in switch statments can mask warnings that might
indicate that a new enum value was added and corresponding changes
to a switch statement that relies on that enum are missed. For this
reason, clang reports when switch statements that fully define case
statements for all possible enum values contain default: statements.

However, this is a warning of a potential problem that might arise
from future changes to the code rather than anything that might be
wrong now. Additionally, while unlikely that an enum switch might
be presented with a value that isn't valid for that enum, it isn't
impossible. So rather than respect this warning, we will silence it.
It's not included by default. LLVM wanted it. We don't, so it's
removed. This makes the earlier external cmake change unnecessary.
Ignores 34 clang warnings

* Update README.md

* [linux-port] Replace tests of never null addresses (microsoft#1318)

Found as part of a project to eliminate warnings, but this is an
actual bug. An HLSL change adds the possibility of a Dxil and an
HLSL module to the base LLVM Module as well as the ability to
retrieve a reference to them when the are present. This reference
retrieval was mistakenly used to determine if the module was
present in spite of the fact that references are never null. Worse
the reference is from a dereferenced pointer, so if it wasn't there,
it would cause a null dereference. The module interface had methods
to query the presence of these submodules, but they weren't used.
fixes 4 clang warnings and possibly some mysterious crashes

The same warning for a different cause is encountered where an
address is taken of a value passed by reference and compared to
null, which can never be true.
Fixes 1 clang warning.

* [linux-port] Evade unused in LLVM code (microsoft#1327)

Primarily if not exclusively due to the massive carveouts of the
original LLVM source base as part of the HLSL adaptation, many
variables and functions are left unused. In keeping with the
practice of commenting or ifdef-ing out unused portions of this
code and marking every such exclusion as an HLSL change, this adds
few comments and moves a lot of preprocessor conditionals around to
encompass the portions left unused as a consequence of the earlier
exclusions.
Fixes 450 clang and 442 gcc warnings.

* [spirv] Append must load lvalues before appending (microsoft#1345)

The AppendStructuredBuffer's Append method was not checking for lvalues.

* [linux-port] Casts for compares and assigns (microsoft#1328)

Various comparisons produce warnings because the values differ in
signedness. This either changes the type of one of the parameters
or else it casts one. This includes adding casts to all of the
defined return error values. Which is more than was needed, but
consistent with some existing values anyway.
Fixes 11 clang and 12 gcc warnings.

Eliminate a few greater than or equal comparisons of unsigned
values which are always true. The most aggressive of this is
the exclusion of a function that has become a no-op because of
HLSL initialization of a key variable that had some invalid
comparisons because of the same const value.
Fixes 4 clang and 7 gcc warnings.

Additionally casts a few parameters to the proper type to silence
warnings about confusing or problem casts. This includes printing
functions, array indices, and deletes of void pointers. The latter
of which might have caused problems.
Fixes 6 clang 6 gcc warnings.

One incidental change that silences a warning about security for
using a string variable as the format for printf. Since it just
outputs the string, fputs is more appropriate anyway. Also
directed to stderr as more appropriate for debug info.

* [linux-port] de-const variables not used as const (microsoft#1331)

pParameters and pStaticSamplers were both marked const in spite of
the qualifier being cast off at nearly every usage. So they lose
their const. If you're the target of memcpy or memset, you are
not const.
Fixes 12 gcc and 12 clang warnings

* [linux-port] Use cross-platform TLS methods (microsoft#1338)

LLVM includes cross-platform thread local storage methods for
saving, retrieving, and deleting thread-specific objects. Using
these methods is superior to the thread_local storage qualifier
because the former works on Apple, Linux, and Windows. It also
uses the same mechanism as the previous Windows implementation
used without compiler idiosyncracies.

Placement new is needed in DxcInitThreadMalloc because operator
new requires the TLS malloc to be in place.

* [linux-port] Correct problematic initializations (microsoft#1321)

Regardless of the order of variables placed in a constructor
member initializer list, the variables are initialized in the
order they are listed in the class or struct. This can cause
issues where the assignment of one variable depends on the other.
For this reason, a warning is produced if the member variables
are listed in a different order. This change moves the member
initializer lists into the order they were being initialized.
Fixes 23 clang and 24 gcc warnings.

Initialization of members of a larger aggregate type may benefit
from braces to clarify which variables are expected to go where.
At the same time, scalars should not be so segregated. This places
or removes such braces wherever appropriate.
Fixes 144 clang warnings

* Modify build script and environment to support ARM64 build (microsoft#1308)

hctstart.cmd and hctbuild.cmd now support ARM64 builds.

Note that building ARM64 build on x86/x64 machine needs a location
of x86/x64 version of TableGen tools (clang-tblgen and llvm-tblgen).
Before starting ARM64 build set the BUILD_TBLGEN_PATH to point to
the TableGen binaries or use the -tblgen option on hctbuild.cmd.

Also had to rearrange control flow around the cmake --build call
in hctbuild.cmd due to a flaky batch behavior around brackets.

* [linux-port] Add missing case statements (microsoft#1346)

When switching over an enum value, the ideal is to include a case
for every possibly value. Where possible, that's what this change
does to silence warnings and also to provide space to properly
handle every possible input and throw a warning should a new one
be added. In some cases, it's not practical to list every input.
In these cases, putting a default that doesn't change the behavior,
but let's the compiler know that the behavior is intended.
Fixes 133 clang and 8108(!) gcc warnings.

* Update to VS 2017 and CMake 3.11.2 (microsoft#1347)

* Change build to prefer VS 2017

* Update supported cmake version

* Remove -vs2017 from appveyor.yml

* [spirv] Update SPIRV-Tools. (microsoft#1348)

* Fix warning on windows release builds (microsoft#1350)

A persistent and occasionally confusing warning is produced on
Windows release builds because of a conditional expression that only
contains an assert. On a release build, this amounts to nothing but
a semicolon, which produces the warning.

This folds the conditional into the previously explicit assert so
it is included or excluded entirely regardless of build type.

* [linux-port] Remove unused from HLSL code (microsoft#1315)

Removes unused variables and functions from code between HLSL
change comments in LLVM code or else in HLSL or SPIRV original
source files along with any code correspondingly rendered unused
or originally in service of these ultimately unused elements.
Each of these produces a warning in clang, gcc, or both.
Fixes around 458 clang warnings and 461 gcc warnings.

* [spirv] Multiplex ModuleBuilder decorations (microsoft#1351)

ModuleBuilder had a catch-all function to apply decorations not
taking additional parameters, however, every single call to this
has an explicit decoration parameter. The switch only slows things
down and doesn't help with code length or anything else. The switch
is missing the other decorations that have custom functions, which
produce warnings. Rather than add a default: case, I've provided
custom decorate functions for each decoration.

* [linux-port] Introduce Windows "adapter" headers (microsoft#1314)

In this CL, we have introduced the "WinAdapter.h" header file.

This file includes declarations and definitions that will enable compilation of the code base on non-Windows platforms. These include:

* Disabling SAL annotations for non-Windows platforms.
* Defining some Windows-specifc macros that are not defined on other platforms.
* Defining Windows-specific types that are used throughout the codebase for non-Windows platforms.

This file is currently not complete. As we go forward, we will add more classes/structs/type definitions to this file for specific purposes. The contents of this file is completely disabled (#ifdef'd away) for Windows, and do not affect Windows compilation in any way.  For the most part, this is our way of enabling compilation of the codebase on non-Windows platforms without making invasive changes to the existing cpp files, and without hindering any future development. Moreover, I have added the #include of this file for all the locations that will need it for successful Linux compilation.
Ehsan (ehsannas) added a commit to google/DirectXShaderCompiler that referenced this pull request Jun 20, 2018
* [spirv] None (0x0) is an invalid Image Operand. (microsoft#1311)

* [linux-port] Update CMake files. prepare for Linux. (microsoft#1312)

This CL makes changes to CMake files in order to:
1- disable things that are not supported on non-Windows platforms.
2- make cross-platform compilation possible.

It also brings back LLVM's config.guess (mirrors:
https://github.com/llvm-mirror/llvm/blob/master/cmake/config.guess)

* [linux-port] More compile improvement (helps GCC). (microsoft#1310)

GCC has what seems to me to be a bug where it disapproves of the members
of a member struct of class OP having the same name as a type imported
by "using". It's the only compiler with the issue and I don't see any real
conflict, but it's easier to placate it than to fix GCC. GCC
claims its ambiguous. Making the member variables lowercase fixes
this neatly.

Removed some PointerStatus:: prefixes from references within the
class itself which upsets GCC.

HLSL changes excluded Transforms/Instrumentation directory entirely
including BoundsChecking. However it didn't excluder one reference
to a function declared there in BackendUtil that fails to link on GCC.
The function that references the missing BoundsChecking function
is static and not used anywhere with current settings. So it's not
considered a symbol to be linked by MSVC or clang, but GCC insists.

* [linux-port] Remove extra semicolons (microsoft#1317)

Terminating classes may create a muscle memory for typing a
semicolon after a left-justified closed brace. Whatever the reason
to GCC's chagrine there were many functions ended with unnecessary
semicolons. Each one caused a warning. This removes them.

Fixes 285 GCC warnings

* [linux-port] Scalar initialization warnings (microsoft#1316)

There is the possibility of a few variables being used without
initialization, which causes some warnings.
Fixes 2 clang warnings

GCC worries that assigning a variable to the result of an
assignment of that same variable may be undefined. It's a silly
thing to do anyway. So it's removed.
Fixes 1 gcc warning.

GCC is quite sure that Interp is too small to hold values of up
to 9 with only 4 bits. Perhaps because the RHS is a variable of
8 bits.
Fixes 47 gcc warnings

* [linux-port] Mark all overridden methods (microsoft#1319)

Clang produces a warning when a method that overrides another is
not marked with the override keyword. Adding the keyword has no
effect on overridden functions, but it is good practice to mark
all methods intended to override as such because if they fail to
do so, the keyword will produce an error.

Fixes 78 Clang warnings.

* [linux-port] Fix preprocessor warnings (microsoft#1323)

Remove pragma once from source files. It has no meaning in a source
file unless it's used as a header, which, fortunately, none of
these are.
Fixes 3 clang and 3 gcc warnings.

Remove trailing tokens after #endifs. Common result from copy,
paste, and slightly alter the beginning #if line to keep the
comments after consistent.
Fixes 3 clang and 3 gcc warnings.

* [linux-port] Correct const casts (microsoft#1324)

There are a lot of cases where const is carelessly cast off. Some
of them lead to really dramatic changes in multiple interfaces to
fix properly. This is instead a subset of cases where const was
disrespected, often for no apparent reason at all. likely just a
mistake in type casting.

Fixes 88 gcc and 88 clang warnings.

* use prettyxml to generate ShaderOpArithTable.xml (microsoft#1192)

* [linux-port] Fix anonymous struct warnings (microsoft#1329)

A most pervasive warning from a minimal amount of code. The Wintypes
header included an anonymous struct in the form of LARGE_INTEGER
which is specified by Microsoft, but the actual MS header includes
another struct in the union for environments that don't want
anonymous structs. Given the minimal usage, I think this can
qualify. Microsoft's own headers will exclude the anonymous struct
in favor of the named one if NONAMELESSSTRUCT is defined before
windows.h. To prevent future uses of the anonymous part of LARGE_
INTEGER, this defines that in WinIncludes.h.
Fixes 148 clang and 148 gcc warnings.

* [linux-port] Fix warnings from lambda functions (microsoft#1320)

Various lambda functions included captured variables that they
didn't actually use. This produces a warning on clang.
Fixes 6 clang warnings.

* [linux-port] Fix DXASSERT warnings (microsoft#1322)

The various DXASSERT macros produced a number of different warnings.
The most obvious was providing an empty string for a macro expecting
a message. Substituting in the _NOMSG macro fixes this.
Fixes 13 clang warnings.

A trickier problem for GCC and Clang is a variadic macro that is
provided no variadic arguments. Both Clang and GCC will avoid
errors by using the ##__VA_ARGS__ non-standard behavior, but it's
not an ideal solution. It turns out there aren't that many DXASSERT
macros that actually take variadic arguments. So I added an _ARGS
variant and replaced those instances with that. An ancillary benefit
is that non variadic asserts can present a message with the assert.
Fixes 583 clang warnings and 582 gcc warnings.

In what I expect was an earlier attempt to overload the DXASSERT
macro, it was defined twice each time with a different number of args.
Sadly, macros can't be overloaded, so this just produced more errors.
Fixes 69 clang warnings and 69 gcc warnings.

Finally, I removed the user declaration of std::error_code because
it is defined in a standard header <system_error>. Because clang was
including that header some places, it saw it as a redefinition. But
the Linux version is a struct and windows is a class. So nothing we
put here can make everyone happy. It doesn't really fit with this
change except for in proximity but doesn't fit anywhere else either.
Fixes 52 clang warnings

* [spirv] Update SPIR-V Tools. (microsoft#1334)

* [linux-port] Remove/dummy unused class components (microsoft#1333)

Clang is smart enough to detect when a class member function or
variable is not used and emits a warning for that case. This
removes all such members as well as any corresponding parameters
and other variables that might have been used to initialize such.
Fixes 8 clang warnings.

NotOptimized in DxilGenerationPass echoed in places that made us
think that it might be needed at some point in spite of not being
used now. So it gets a dummy reference instead of being removed.

* [linux-port] Dummy access to unused variables (microsoft#1325)

Simply including a variable as the entirity of an expression is
insufficient to silence warnings for gcc and clang. The variable
is not reported as unused, which is the intent, but the expression
result is reported in a warning as unused. By casting that
expression as (void), both warnings are silenced.
Fixes 110 clang and 40 gcc warnings.

* [linux-port] Fix spirv test warnings (microsoft#1337)

clang-spirv-tests uses a lot of external projects that keep
themselves clean with different standards of warnings flags.
This alters the appropriate cmake files to disable flags that
the DXC build enables.
Fixes 72 gcc and 166 clang warnings.

Additionally catch some sign mismatch comparisons in tests
built as part of clang-spirv-tests.
Fixes 2 gcc and 2 clang warnings, but one of them has multiple sources
So it's kind of a lot more.

* [linux-port] Correct conditional groupings (microsoft#1326)

Clang and gcc complain when AND and OR logical operations are both
used in a single conditional because of the possibility of mistakes
when depending solely on operator precedence. In fact, this change
fixes a few clear errors mostly in asserts that would never fire.
Fixes 13 clang and 22 gcc warnings.

Additionally, when two if statements are followed by an else, there
may be some ambiguity in terms of which if the else applies to. It
is the closest one, the second in the case of two, but it is another
area of potential mistakes. Adding braces around the code intended
as the block of the first if conditional clarifies this.
fixed 8 clang and 8 gcc warnings.

Clang complains sometimes when assignments take place in a
conditional without additional parenthesis around it. It can
indicate when what was meant to be an equal comparison is replaced
with an assignment.
fixes 2 clang warnings.

* [linux-port] Unused variables in conditionals (microsoft#1336)

A surprising number of if statements declare variables in their
parentheses. Usually, these variables are used afterward. When they
are not, gcc produces a warning. clang does not.
Fixes gcc warnings.

* [linux-port] disable covered-switch-default warning (microsoft#1332)

Defaults in switch statments can mask warnings that might
indicate that a new enum value was added and corresponding changes
to a switch statement that relies on that enum are missed. For this
reason, clang reports when switch statements that fully define case
statements for all possible enum values contain default: statements.

However, this is a warning of a potential problem that might arise
from future changes to the code rather than anything that might be
wrong now. Additionally, while unlikely that an enum switch might
be presented with a value that isn't valid for that enum, it isn't
impossible. So rather than respect this warning, we will silence it.
It's not included by default. LLVM wanted it. We don't, so it's
removed. This makes the earlier external cmake change unnecessary.
Ignores 34 clang warnings

* Update README.md

* [linux-port] Replace tests of never null addresses (microsoft#1318)

Found as part of a project to eliminate warnings, but this is an
actual bug. An HLSL change adds the possibility of a Dxil and an
HLSL module to the base LLVM Module as well as the ability to
retrieve a reference to them when the are present. This reference
retrieval was mistakenly used to determine if the module was
present in spite of the fact that references are never null. Worse
the reference is from a dereferenced pointer, so if it wasn't there,
it would cause a null dereference. The module interface had methods
to query the presence of these submodules, but they weren't used.
fixes 4 clang warnings and possibly some mysterious crashes

The same warning for a different cause is encountered where an
address is taken of a value passed by reference and compared to
null, which can never be true.
Fixes 1 clang warning.

* [linux-port] Evade unused in LLVM code (microsoft#1327)

Primarily if not exclusively due to the massive carveouts of the
original LLVM source base as part of the HLSL adaptation, many
variables and functions are left unused. In keeping with the
practice of commenting or ifdef-ing out unused portions of this
code and marking every such exclusion as an HLSL change, this adds
few comments and moves a lot of preprocessor conditionals around to
encompass the portions left unused as a consequence of the earlier
exclusions.
Fixes 450 clang and 442 gcc warnings.

* [spirv] Append must load lvalues before appending (microsoft#1345)

The AppendStructuredBuffer's Append method was not checking for lvalues.

* [linux-port] Casts for compares and assigns (microsoft#1328)

Various comparisons produce warnings because the values differ in
signedness. This either changes the type of one of the parameters
or else it casts one. This includes adding casts to all of the
defined return error values. Which is more than was needed, but
consistent with some existing values anyway.
Fixes 11 clang and 12 gcc warnings.

Eliminate a few greater than or equal comparisons of unsigned
values which are always true. The most aggressive of this is
the exclusion of a function that has become a no-op because of
HLSL initialization of a key variable that had some invalid
comparisons because of the same const value.
Fixes 4 clang and 7 gcc warnings.

Additionally casts a few parameters to the proper type to silence
warnings about confusing or problem casts. This includes printing
functions, array indices, and deletes of void pointers. The latter
of which might have caused problems.
Fixes 6 clang 6 gcc warnings.

One incidental change that silences a warning about security for
using a string variable as the format for printf. Since it just
outputs the string, fputs is more appropriate anyway. Also
directed to stderr as more appropriate for debug info.

* [linux-port] de-const variables not used as const (microsoft#1331)

pParameters and pStaticSamplers were both marked const in spite of
the qualifier being cast off at nearly every usage. So they lose
their const. If you're the target of memcpy or memset, you are
not const.
Fixes 12 gcc and 12 clang warnings

* [linux-port] Use cross-platform TLS methods (microsoft#1338)

LLVM includes cross-platform thread local storage methods for
saving, retrieving, and deleting thread-specific objects. Using
these methods is superior to the thread_local storage qualifier
because the former works on Apple, Linux, and Windows. It also
uses the same mechanism as the previous Windows implementation
used without compiler idiosyncracies.

Placement new is needed in DxcInitThreadMalloc because operator
new requires the TLS malloc to be in place.

* [linux-port] Correct problematic initializations (microsoft#1321)

Regardless of the order of variables placed in a constructor
member initializer list, the variables are initialized in the
order they are listed in the class or struct. This can cause
issues where the assignment of one variable depends on the other.
For this reason, a warning is produced if the member variables
are listed in a different order. This change moves the member
initializer lists into the order they were being initialized.
Fixes 23 clang and 24 gcc warnings.

Initialization of members of a larger aggregate type may benefit
from braces to clarify which variables are expected to go where.
At the same time, scalars should not be so segregated. This places
or removes such braces wherever appropriate.
Fixes 144 clang warnings

* Modify build script and environment to support ARM64 build (microsoft#1308)

hctstart.cmd and hctbuild.cmd now support ARM64 builds.

Note that building ARM64 build on x86/x64 machine needs a location
of x86/x64 version of TableGen tools (clang-tblgen and llvm-tblgen).
Before starting ARM64 build set the BUILD_TBLGEN_PATH to point to
the TableGen binaries or use the -tblgen option on hctbuild.cmd.

Also had to rearrange control flow around the cmake --build call
in hctbuild.cmd due to a flaky batch behavior around brackets.

* [linux-port] Add missing case statements (microsoft#1346)

When switching over an enum value, the ideal is to include a case
for every possibly value. Where possible, that's what this change
does to silence warnings and also to provide space to properly
handle every possible input and throw a warning should a new one
be added. In some cases, it's not practical to list every input.
In these cases, putting a default that doesn't change the behavior,
but let's the compiler know that the behavior is intended.
Fixes 133 clang and 8108(!) gcc warnings.

* Update to VS 2017 and CMake 3.11.2 (microsoft#1347)

* Change build to prefer VS 2017

* Update supported cmake version

* Remove -vs2017 from appveyor.yml

* [spirv] Update SPIRV-Tools. (microsoft#1348)

* Fix warning on windows release builds (microsoft#1350)

A persistent and occasionally confusing warning is produced on
Windows release builds because of a conditional expression that only
contains an assert. On a release build, this amounts to nothing but
a semicolon, which produces the warning.

This folds the conditional into the previously explicit assert so
it is included or excluded entirely regardless of build type.

* [linux-port] Remove unused from HLSL code (microsoft#1315)

Removes unused variables and functions from code between HLSL
change comments in LLVM code or else in HLSL or SPIRV original
source files along with any code correspondingly rendered unused
or originally in service of these ultimately unused elements.
Each of these produces a warning in clang, gcc, or both.
Fixes around 458 clang warnings and 461 gcc warnings.

* [spirv] Multiplex ModuleBuilder decorations (microsoft#1351)

ModuleBuilder had a catch-all function to apply decorations not
taking additional parameters, however, every single call to this
has an explicit decoration parameter. The switch only slows things
down and doesn't help with code length or anything else. The switch
is missing the other decorations that have custom functions, which
produce warnings. Rather than add a default: case, I've provided
custom decorate functions for each decoration.

* [linux-port] Introduce Windows "adapter" headers (microsoft#1314)

In this CL, we have introduced the "WinAdapter.h" header file.

This file includes declarations and definitions that will enable compilation of the code base on non-Windows platforms. These include:

* Disabling SAL annotations for non-Windows platforms.
* Defining some Windows-specifc macros that are not defined on other platforms.
* Defining Windows-specific types that are used throughout the codebase for non-Windows platforms.

This file is currently not complete. As we go forward, we will add more classes/structs/type definitions to this file for specific purposes. The contents of this file is completely disabled (#ifdef'd away) for Windows, and do not affect Windows compilation in any way.  For the most part, this is our way of enabling compilation of the codebase on non-Windows platforms without making invasive changes to the existing cpp files, and without hindering any future development. Moreover, I have added the #include of this file for all the locations that will need it for successful Linux compilation.

* Use CreateFileW instead of CreateFile2 (microsoft#1301)

Fixes microsoft#1265

* Propagate /no-warnings flag (microsoft#1349)

* Propagate /no-warnings flag

* With these changes, warnings are not shown when /no-warnings flag is used and they get printed when /no-warnings flag is not used. The exact behavior is mirrored when a user decides to output warnings and errors to an output file by using /Fe flag.

* [linux-port] Minor changes towards cross-platform compilation. (microsoft#1352)

* [spirv] Update external dependencies (microsoft#1355)

* [spirv] Fix accessing (RW)Buffer sub-element using [][] (microsoft#1354)

Accessing sub-elements in (RW)Buffer with adjacent array subscript
operators was falsely translated into an OpAccessChain with two
indices. Instead, we need to perform OpImage* on the (RW)Buffer
object and then do single-index OpAccessChain.

* Add IDxcVersionInfo2 for querying Git commit info (microsoft#1304)

This will give users a way to know the commit from which a DXC
library/binary was built from, so that they can compare different
libraries/binaries and report bugs easily.

dxc.exe now also prints the commit info using this new interface
method. It uses the following format:

  (dev;<commit-count>-<commit-hash>)

* [linux-port] Factor out CoTaskMem* into WinAdapter.
Ehsan (ehsannas) added a commit to google/DirectXShaderCompiler that referenced this pull request Jun 26, 2018
* [spirv] None (0x0) is an invalid Image Operand. (microsoft#1311)

* [linux-port] Update CMake files. prepare for Linux. (microsoft#1312)

This CL makes changes to CMake files in order to:
1- disable things that are not supported on non-Windows platforms.
2- make cross-platform compilation possible.

It also brings back LLVM's config.guess (mirrors:
https://github.com/llvm-mirror/llvm/blob/master/cmake/config.guess)

* [linux-port] More compile improvement (helps GCC). (microsoft#1310)

GCC has what seems to me to be a bug where it disapproves of the members
of a member struct of class OP having the same name as a type imported
by "using". It's the only compiler with the issue and I don't see any real
conflict, but it's easier to placate it than to fix GCC. GCC
claims its ambiguous. Making the member variables lowercase fixes
this neatly.

Removed some PointerStatus:: prefixes from references within the
class itself which upsets GCC.

HLSL changes excluded Transforms/Instrumentation directory entirely
including BoundsChecking. However it didn't excluder one reference
to a function declared there in BackendUtil that fails to link on GCC.
The function that references the missing BoundsChecking function
is static and not used anywhere with current settings. So it's not
considered a symbol to be linked by MSVC or clang, but GCC insists.

* [linux-port] Remove extra semicolons (microsoft#1317)

Terminating classes may create a muscle memory for typing a
semicolon after a left-justified closed brace. Whatever the reason
to GCC's chagrine there were many functions ended with unnecessary
semicolons. Each one caused a warning. This removes them.

Fixes 285 GCC warnings

* [linux-port] Scalar initialization warnings (microsoft#1316)

There is the possibility of a few variables being used without
initialization, which causes some warnings.
Fixes 2 clang warnings

GCC worries that assigning a variable to the result of an
assignment of that same variable may be undefined. It's a silly
thing to do anyway. So it's removed.
Fixes 1 gcc warning.

GCC is quite sure that Interp is too small to hold values of up
to 9 with only 4 bits. Perhaps because the RHS is a variable of
8 bits.
Fixes 47 gcc warnings

* [linux-port] Mark all overridden methods (microsoft#1319)

Clang produces a warning when a method that overrides another is
not marked with the override keyword. Adding the keyword has no
effect on overridden functions, but it is good practice to mark
all methods intended to override as such because if they fail to
do so, the keyword will produce an error.

Fixes 78 Clang warnings.

* [linux-port] Fix preprocessor warnings (microsoft#1323)

Remove pragma once from source files. It has no meaning in a source
file unless it's used as a header, which, fortunately, none of
these are.
Fixes 3 clang and 3 gcc warnings.

Remove trailing tokens after #endifs. Common result from copy,
paste, and slightly alter the beginning #if line to keep the
comments after consistent.
Fixes 3 clang and 3 gcc warnings.

* [linux-port] Correct const casts (microsoft#1324)

There are a lot of cases where const is carelessly cast off. Some
of them lead to really dramatic changes in multiple interfaces to
fix properly. This is instead a subset of cases where const was
disrespected, often for no apparent reason at all. likely just a
mistake in type casting.

Fixes 88 gcc and 88 clang warnings.

* use prettyxml to generate ShaderOpArithTable.xml (microsoft#1192)

* [linux-port] Fix anonymous struct warnings (microsoft#1329)

A most pervasive warning from a minimal amount of code. The Wintypes
header included an anonymous struct in the form of LARGE_INTEGER
which is specified by Microsoft, but the actual MS header includes
another struct in the union for environments that don't want
anonymous structs. Given the minimal usage, I think this can
qualify. Microsoft's own headers will exclude the anonymous struct
in favor of the named one if NONAMELESSSTRUCT is defined before
windows.h. To prevent future uses of the anonymous part of LARGE_
INTEGER, this defines that in WinIncludes.h.
Fixes 148 clang and 148 gcc warnings.

* [linux-port] Fix warnings from lambda functions (microsoft#1320)

Various lambda functions included captured variables that they
didn't actually use. This produces a warning on clang.
Fixes 6 clang warnings.

* [linux-port] Fix DXASSERT warnings (microsoft#1322)

The various DXASSERT macros produced a number of different warnings.
The most obvious was providing an empty string for a macro expecting
a message. Substituting in the _NOMSG macro fixes this.
Fixes 13 clang warnings.

A trickier problem for GCC and Clang is a variadic macro that is
provided no variadic arguments. Both Clang and GCC will avoid
errors by using the ##__VA_ARGS__ non-standard behavior, but it's
not an ideal solution. It turns out there aren't that many DXASSERT
macros that actually take variadic arguments. So I added an _ARGS
variant and replaced those instances with that. An ancillary benefit
is that non variadic asserts can present a message with the assert.
Fixes 583 clang warnings and 582 gcc warnings.

In what I expect was an earlier attempt to overload the DXASSERT
macro, it was defined twice each time with a different number of args.
Sadly, macros can't be overloaded, so this just produced more errors.
Fixes 69 clang warnings and 69 gcc warnings.

Finally, I removed the user declaration of std::error_code because
it is defined in a standard header <system_error>. Because clang was
including that header some places, it saw it as a redefinition. But
the Linux version is a struct and windows is a class. So nothing we
put here can make everyone happy. It doesn't really fit with this
change except for in proximity but doesn't fit anywhere else either.
Fixes 52 clang warnings

* [spirv] Update SPIR-V Tools. (microsoft#1334)

* [linux-port] Remove/dummy unused class components (microsoft#1333)

Clang is smart enough to detect when a class member function or
variable is not used and emits a warning for that case. This
removes all such members as well as any corresponding parameters
and other variables that might have been used to initialize such.
Fixes 8 clang warnings.

NotOptimized in DxilGenerationPass echoed in places that made us
think that it might be needed at some point in spite of not being
used now. So it gets a dummy reference instead of being removed.

* [linux-port] Dummy access to unused variables (microsoft#1325)

Simply including a variable as the entirity of an expression is
insufficient to silence warnings for gcc and clang. The variable
is not reported as unused, which is the intent, but the expression
result is reported in a warning as unused. By casting that
expression as (void), both warnings are silenced.
Fixes 110 clang and 40 gcc warnings.

* [linux-port] Fix spirv test warnings (microsoft#1337)

clang-spirv-tests uses a lot of external projects that keep
themselves clean with different standards of warnings flags.
This alters the appropriate cmake files to disable flags that
the DXC build enables.
Fixes 72 gcc and 166 clang warnings.

Additionally catch some sign mismatch comparisons in tests
built as part of clang-spirv-tests.
Fixes 2 gcc and 2 clang warnings, but one of them has multiple sources
So it's kind of a lot more.

* [linux-port] Correct conditional groupings (microsoft#1326)

Clang and gcc complain when AND and OR logical operations are both
used in a single conditional because of the possibility of mistakes
when depending solely on operator precedence. In fact, this change
fixes a few clear errors mostly in asserts that would never fire.
Fixes 13 clang and 22 gcc warnings.

Additionally, when two if statements are followed by an else, there
may be some ambiguity in terms of which if the else applies to. It
is the closest one, the second in the case of two, but it is another
area of potential mistakes. Adding braces around the code intended
as the block of the first if conditional clarifies this.
fixed 8 clang and 8 gcc warnings.

Clang complains sometimes when assignments take place in a
conditional without additional parenthesis around it. It can
indicate when what was meant to be an equal comparison is replaced
with an assignment.
fixes 2 clang warnings.

* [linux-port] Unused variables in conditionals (microsoft#1336)

A surprising number of if statements declare variables in their
parentheses. Usually, these variables are used afterward. When they
are not, gcc produces a warning. clang does not.
Fixes gcc warnings.

* [linux-port] disable covered-switch-default warning (microsoft#1332)

Defaults in switch statments can mask warnings that might
indicate that a new enum value was added and corresponding changes
to a switch statement that relies on that enum are missed. For this
reason, clang reports when switch statements that fully define case
statements for all possible enum values contain default: statements.

However, this is a warning of a potential problem that might arise
from future changes to the code rather than anything that might be
wrong now. Additionally, while unlikely that an enum switch might
be presented with a value that isn't valid for that enum, it isn't
impossible. So rather than respect this warning, we will silence it.
It's not included by default. LLVM wanted it. We don't, so it's
removed. This makes the earlier external cmake change unnecessary.
Ignores 34 clang warnings

* Update README.md

* [linux-port] Replace tests of never null addresses (microsoft#1318)

Found as part of a project to eliminate warnings, but this is an
actual bug. An HLSL change adds the possibility of a Dxil and an
HLSL module to the base LLVM Module as well as the ability to
retrieve a reference to them when the are present. This reference
retrieval was mistakenly used to determine if the module was
present in spite of the fact that references are never null. Worse
the reference is from a dereferenced pointer, so if it wasn't there,
it would cause a null dereference. The module interface had methods
to query the presence of these submodules, but they weren't used.
fixes 4 clang warnings and possibly some mysterious crashes

The same warning for a different cause is encountered where an
address is taken of a value passed by reference and compared to
null, which can never be true.
Fixes 1 clang warning.

* [linux-port] Evade unused in LLVM code (microsoft#1327)

Primarily if not exclusively due to the massive carveouts of the
original LLVM source base as part of the HLSL adaptation, many
variables and functions are left unused. In keeping with the
practice of commenting or ifdef-ing out unused portions of this
code and marking every such exclusion as an HLSL change, this adds
few comments and moves a lot of preprocessor conditionals around to
encompass the portions left unused as a consequence of the earlier
exclusions.
Fixes 450 clang and 442 gcc warnings.

* [spirv] Append must load lvalues before appending (microsoft#1345)

The AppendStructuredBuffer's Append method was not checking for lvalues.

* [linux-port] Casts for compares and assigns (microsoft#1328)

Various comparisons produce warnings because the values differ in
signedness. This either changes the type of one of the parameters
or else it casts one. This includes adding casts to all of the
defined return error values. Which is more than was needed, but
consistent with some existing values anyway.
Fixes 11 clang and 12 gcc warnings.

Eliminate a few greater than or equal comparisons of unsigned
values which are always true. The most aggressive of this is
the exclusion of a function that has become a no-op because of
HLSL initialization of a key variable that had some invalid
comparisons because of the same const value.
Fixes 4 clang and 7 gcc warnings.

Additionally casts a few parameters to the proper type to silence
warnings about confusing or problem casts. This includes printing
functions, array indices, and deletes of void pointers. The latter
of which might have caused problems.
Fixes 6 clang 6 gcc warnings.

One incidental change that silences a warning about security for
using a string variable as the format for printf. Since it just
outputs the string, fputs is more appropriate anyway. Also
directed to stderr as more appropriate for debug info.

* [linux-port] de-const variables not used as const (microsoft#1331)

pParameters and pStaticSamplers were both marked const in spite of
the qualifier being cast off at nearly every usage. So they lose
their const. If you're the target of memcpy or memset, you are
not const.
Fixes 12 gcc and 12 clang warnings

* [linux-port] Use cross-platform TLS methods (microsoft#1338)

LLVM includes cross-platform thread local storage methods for
saving, retrieving, and deleting thread-specific objects. Using
these methods is superior to the thread_local storage qualifier
because the former works on Apple, Linux, and Windows. It also
uses the same mechanism as the previous Windows implementation
used without compiler idiosyncracies.

Placement new is needed in DxcInitThreadMalloc because operator
new requires the TLS malloc to be in place.

* [linux-port] Correct problematic initializations (microsoft#1321)

Regardless of the order of variables placed in a constructor
member initializer list, the variables are initialized in the
order they are listed in the class or struct. This can cause
issues where the assignment of one variable depends on the other.
For this reason, a warning is produced if the member variables
are listed in a different order. This change moves the member
initializer lists into the order they were being initialized.
Fixes 23 clang and 24 gcc warnings.

Initialization of members of a larger aggregate type may benefit
from braces to clarify which variables are expected to go where.
At the same time, scalars should not be so segregated. This places
or removes such braces wherever appropriate.
Fixes 144 clang warnings

* Modify build script and environment to support ARM64 build (microsoft#1308)

hctstart.cmd and hctbuild.cmd now support ARM64 builds.

Note that building ARM64 build on x86/x64 machine needs a location
of x86/x64 version of TableGen tools (clang-tblgen and llvm-tblgen).
Before starting ARM64 build set the BUILD_TBLGEN_PATH to point to
the TableGen binaries or use the -tblgen option on hctbuild.cmd.

Also had to rearrange control flow around the cmake --build call
in hctbuild.cmd due to a flaky batch behavior around brackets.

* [linux-port] Add missing case statements (microsoft#1346)

When switching over an enum value, the ideal is to include a case
for every possibly value. Where possible, that's what this change
does to silence warnings and also to provide space to properly
handle every possible input and throw a warning should a new one
be added. In some cases, it's not practical to list every input.
In these cases, putting a default that doesn't change the behavior,
but let's the compiler know that the behavior is intended.
Fixes 133 clang and 8108(!) gcc warnings.

* Update to VS 2017 and CMake 3.11.2 (microsoft#1347)

* Change build to prefer VS 2017

* Update supported cmake version

* Remove -vs2017 from appveyor.yml

* [spirv] Update SPIRV-Tools. (microsoft#1348)

* Fix warning on windows release builds (microsoft#1350)

A persistent and occasionally confusing warning is produced on
Windows release builds because of a conditional expression that only
contains an assert. On a release build, this amounts to nothing but
a semicolon, which produces the warning.

This folds the conditional into the previously explicit assert so
it is included or excluded entirely regardless of build type.

* [linux-port] Remove unused from HLSL code (microsoft#1315)

Removes unused variables and functions from code between HLSL
change comments in LLVM code or else in HLSL or SPIRV original
source files along with any code correspondingly rendered unused
or originally in service of these ultimately unused elements.
Each of these produces a warning in clang, gcc, or both.
Fixes around 458 clang warnings and 461 gcc warnings.

* [spirv] Multiplex ModuleBuilder decorations (microsoft#1351)

ModuleBuilder had a catch-all function to apply decorations not
taking additional parameters, however, every single call to this
has an explicit decoration parameter. The switch only slows things
down and doesn't help with code length or anything else. The switch
is missing the other decorations that have custom functions, which
produce warnings. Rather than add a default: case, I've provided
custom decorate functions for each decoration.

* [linux-port] Introduce Windows "adapter" headers (microsoft#1314)

In this CL, we have introduced the "WinAdapter.h" header file.

This file includes declarations and definitions that will enable compilation of the code base on non-Windows platforms. These include:

* Disabling SAL annotations for non-Windows platforms.
* Defining some Windows-specifc macros that are not defined on other platforms.
* Defining Windows-specific types that are used throughout the codebase for non-Windows platforms.

This file is currently not complete. As we go forward, we will add more classes/structs/type definitions to this file for specific purposes. The contents of this file is completely disabled (#ifdef'd away) for Windows, and do not affect Windows compilation in any way.  For the most part, this is our way of enabling compilation of the codebase on non-Windows platforms without making invasive changes to the existing cpp files, and without hindering any future development. Moreover, I have added the #include of this file for all the locations that will need it for successful Linux compilation.

* Use CreateFileW instead of CreateFile2 (microsoft#1301)

Fixes microsoft#1265

* Propagate /no-warnings flag (microsoft#1349)

* Propagate /no-warnings flag

* With these changes, warnings are not shown when /no-warnings flag is used and they get printed when /no-warnings flag is not used. The exact behavior is mirrored when a user decides to output warnings and errors to an output file by using /Fe flag.

* [linux-port] Minor changes towards cross-platform compilation. (microsoft#1352)

* [spirv] Update external dependencies (microsoft#1355)

* [spirv] Fix accessing (RW)Buffer sub-element using [][] (microsoft#1354)

Accessing sub-elements in (RW)Buffer with adjacent array subscript
operators was falsely translated into an OpAccessChain with two
indices. Instead, we need to perform OpImage* on the (RW)Buffer
object and then do single-index OpAccessChain.

* Add IDxcVersionInfo2 for querying Git commit info (microsoft#1304)

This will give users a way to know the commit from which a DXC
library/binary was built from, so that they can compare different
libraries/binaries and report bugs easily.

dxc.exe now also prints the commit info using this new interface
method. It uses the following format:

  (dev;<commit-count>-<commit-hash>)

* [spirv] Properly initialize and cleanup for tests. (microsoft#1360)

* [linux-port] Handling of target triple. (microsoft#1359)

* [linux-port] Eliminate warnings on release builds (microsoft#1361)

A number of warnings unique to release buildsi persist. Some of these
same errors were fixed earlier for debug builds.

DXASSERT_LOCALVAR still took a variadic macro on release builds.
Fixes 85 clang warnings

Expressions used only as conditionals for asserts were not properly
dummied out with (void) cast.
Fixes 7 clang warnings

Variables used only in asserts dummied out.
Fixes 27 clang warnings

Potential uninitilized uses of variables assigned in switches/ifs.
fixes 5 clang warnings

put braces around empty else statements
11 gcc warnings

* [spirv] Fix counter_binding precedence and test (microsoft#1363)

A missing `else` made it possible for a resource variable with a
corresponding counter variable that was defined with both
vk::binding and :register, each indicating a different descriptor
set to have the main variable assigned the set indicated by
vk::binding while the counter went to the set indicated by the register

Adds a new test for this and other such conditions.

* [appveyor] Clone the whole history (microsoft#1365)

Right now we have a mechanism to version rolling build. It depends
on the Git history and will count number of commits. So we need
the full history.

* [spirv] Clean up SPIR-V types (microsoft#1366)

* Correct min21_int typo in ItaniumMangle (microsoft#1369)

Determines what the type is represented as in function name mangling.
Just as easy to get it right. Simple typo fix.

Fixes microsoft#1368

* [spirv] Avoid unifying struct types with different names (microsoft#1367)

We were unifying struct types as long as they have the exact
same members (regardless of names). BUt it turns out some
reflection workflow requires the exact original struct type
to work.

* [linux-port] Add MultiByte<->WideChar methods. (microsoft#1357)

* [linux-port] Cross-platform critical section (microsoft#1339)

InitializeCriticalSection, DeleteCriticalSection, EnterCriticalSection,
and LeaveCriticalSection serve to create a mutual exclusion section of
code, but they are stubbed out currently for non-win platforms.

There is multi-platform support for the same functionality in LLVM
in the form of SmartMutex. This switches from the Windows specific
to the abstraction, allowing the same code to work on other platforms.

* [linux-port] Complete the Windows adapter code. (microsoft#1358)

This change completes the necessary adapter code needed to enable
cross-platform compilation.

Discussion on the design/implementation of these are in issue microsoft#1341 and
isuee microsoft#1342.

In addition to the adapter classes/structs, there exists usages of
Windows-specific functions in the codebase. In some cases, we won't need
to compile/run some of those methods on non-Windows platforms. For the
few cases where we do, we have implemented equivalent functionality in
WindowsFunctions.cpp.

* [linux-port] Enable some code. Disable some code. (microsoft#1372)

Some code originally in llvm/clang was commented out, and was replaced
with Windows-specific implementation. In this change we bring back some
of those.

Also disabled some code that is not relevant any more.

And a few minor improvements towards cross-platform compilation.

* Update SPIRV-Tools and fix spacing to match MS.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Feature suggestion linux Linux-specific work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants