Skip to content

Commit 948629a

Browse files
authored
Execution Tests: Fix W4505 (unreferenced local function has been removed) offenses (#8003)
Some downstream consumers of the exec tests are required to enable [W4505](https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-4-c4505?view=msvc-170) as an error. This is triggered when a static function is removed via dead code removal for not being used in its translation unit. The recommended fix for this is to instead declare the shared functions in the header as inline.
1 parent a542cd4 commit 948629a

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

tools/clang/unittests/HLSLExec/TableParameterHandler.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ class TableParameterHandler {
7575
template <class T1> std::vector<T1> *GetDataArray(LPCWSTR name);
7676
};
7777

78-
// Static helpers
79-
static bool IsHexString(PCWSTR str, uint16_t *value) {
78+
inline bool IsHexString(PCWSTR str, uint16_t *value) {
8079
std::wstring wString(str);
8180
wString.erase(std::remove(wString.begin(), wString.end(), L' '),
8281
wString.end());
@@ -88,7 +87,7 @@ static bool IsHexString(PCWSTR str, uint16_t *value) {
8887
return false;
8988
}
9089

91-
static HRESULT ParseDataToFloat(PCWSTR str, float &value) {
90+
inline HRESULT ParseDataToFloat(PCWSTR str, float &value) {
9291
std::wstring wString(str);
9392
wString.erase(std::remove(wString.begin(), wString.end(), L' '),
9493
wString.end());
@@ -127,7 +126,7 @@ static HRESULT ParseDataToFloat(PCWSTR str, float &value) {
127126
return S_OK;
128127
}
129128

130-
static HRESULT ParseDataToUint(PCWSTR str, unsigned int &value) {
129+
inline HRESULT ParseDataToUint(PCWSTR str, unsigned int &value) {
131130
std::wstring wString(str);
132131
wString.erase(std::remove(wString.begin(), wString.end(), L' '),
133132
wString.end());
@@ -147,7 +146,7 @@ static HRESULT ParseDataToUint(PCWSTR str, unsigned int &value) {
147146
return S_OK;
148147
}
149148

150-
static HRESULT ParseDataToVectorFloat(PCWSTR str, float *ptr, size_t count) {
149+
inline HRESULT ParseDataToVectorFloat(PCWSTR str, float *ptr, size_t count) {
151150
std::wstring wstr(str);
152151
size_t curPosition = 0;
153152
// parse a string of dot product separated by commas
@@ -163,7 +162,7 @@ static HRESULT ParseDataToVectorFloat(PCWSTR str, float *ptr, size_t count) {
163162
return S_OK;
164163
}
165164

166-
static HRESULT ParseDataToVectorHalf(PCWSTR str, uint16_t *ptr, size_t count) {
165+
inline HRESULT ParseDataToVectorHalf(PCWSTR str, uint16_t *ptr, size_t count) {
167166
std::wstring wstr(str);
168167
size_t curPosition = 0;
169168
// parse a string of dot product separated by commas
@@ -181,7 +180,7 @@ static HRESULT ParseDataToVectorHalf(PCWSTR str, uint16_t *ptr, size_t count) {
181180
return S_OK;
182181
}
183182

184-
static HRESULT ParseDataToVectorUint(PCWSTR str, unsigned int *ptr,
183+
inline HRESULT ParseDataToVectorUint(PCWSTR str, unsigned int *ptr,
185184
size_t count) {
186185
std::wstring wstr(str);
187186
size_t curPosition = 0;

0 commit comments

Comments
 (0)