Fix Clang and ld warnings#8634
Conversation
jkwak-work
left a comment
There was a problem hiding this comment.
I left a few comments.
The PR description says something about memset.
warning: first argument in call to 'memset' is a pointer to non-trivially copyable type '...' [-Wnontrivial-memcall]
But I am not sure which lines are related to that.
The lines changed in slang-ir.cpp are. I replaced calls to |
|
I forgot to mention, I also got 6 |
Fixes the following ld warning:
```
/usr/bin/ld: tools/CMakeFiles/slang-fiddle.dir/Debug/slang-fiddle/slang-fiddle-lua.cpp.o: in function `os_tmpname(lua_State*)':
/home/ncelik/projects/slang/external/lua/loslib.c:174:(.text+0x33ad1): warning: the use of `tmpnam' is dangerous, better use `mkstemp'
```
Fixes compiler warnings of the following kinds, emitted when compiling
with Clang 20:
- `warning: implicit conversion from 'int' to 'float' changes value from 2147483647 to 2147483648 [-Wimplicit-const-int-float-conversion]`
- `warning: first argument in call to 'memset' is a pointer to non-trivially copyable type '...' [-Wnontrivial-memcall]`
Disables `-Wunused-but-set-variable` warnings (after discussion with
Slang maintainers), e.g.,
```
/home/ncelik/projects/slang/source/slang/slang-ast-val.h:382:28: warning: variable 'thatGenParam' set but not used [-Wunused-but-set-variable]
382 | if (const auto thatGenParam = as<DeclRefIntVal>(other.getParam()))
| ^
```
aa0b14d to
0346146
Compare
jkwak-work
left a comment
There was a problem hiding this comment.
Please keep the comment.
|
I think that we should actually remove -Wno-error=unused-but-set-variable. I think in the past I went through and fixed all of these by prefixing them with although to be honest I think that we should definitely discourage this pattern, especially given the surprising scoping rules from variables declared in that position. |
Pull Request is not mergeable
Fixes the following ld warning:
```
/usr/bin/ld: tools/CMakeFiles/slang-fiddle.dir/Debug/slang-fiddle/slang-fiddle-lua.cpp.o: in function `os_tmpname(lua_State*)':
/home/ncelik/projects/slang/external/lua/loslib.c:174:(.text+0x33ad1): warning: the use of `tmpnam' is dangerous, better use `mkstemp'
```
Fixes compiler warnings of the following kinds, emitted when compiling
with Clang 20:
- `warning: implicit conversion from 'int' to 'float' changes value from
2147483647 to 2147483648 [-Wimplicit-const-int-float-conversion]`
- `warning: first argument in call to 'memset' is a pointer to
non-trivially copyable type '...' [-Wnontrivial-memcall]`
Disables `-Wunused-but-set-variable` warnings (after discussion with
Slang maintainers), e.g.,
```
/home/ncelik/projects/slang/source/slang/slang-ast-val.h:382:28: warning: variable 'thatGenParam' set but not used [-Wunused-but-set-variable]
382 | if (const auto thatGenParam = as<DeclRefIntVal>(other.getParam()))
| ^
```
---------
Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
Fixes the following warning emitted by Clang 20: ``` warning: first argument in call to 'memset' is a pointer to non-trivially copyable type 'IRConstant' [-Wnontrivial-memcall] ``` See shader-slang#8634.
Fixes the following warning emitted by Clang 20: ``` warning: first argument in call to 'memset' is a pointer to non-trivially copyable type 'IRConstant' [-Wnontrivial-memcall] ``` See #8634. Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
Fixes the following ld warning:
Fixes compiler warnings of the following kinds, emitted when compiling
with Clang 20:
warning: implicit conversion from 'int' to 'float' changes value from 2147483647 to 2147483648 [-Wimplicit-const-int-float-conversion]warning: first argument in call to 'memset' is a pointer to non-trivially copyable type '...' [-Wnontrivial-memcall]Disables
-Wunused-but-set-variablewarnings (after discussion withSlang maintainers), e.g.,