Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SmallVector.h: avoid casting away constness #821

Merged
merged 1 commit into from
Sep 14, 2023

Conversation

tdp2110
Copy link
Contributor

@tdp2110 tdp2110 commented Sep 13, 2023

Casting to void* removes constness if T is a const type. Even though the casting here is safe (i.e., no modifications are made), some compilers warn about the cast anyway. Avoid casting away constness to remove some picky compiler warnings.

Casting to `void*` removes constness if `T` is a `const` type. Even though the casting here is safe (i.e., no modifications are made), some compilers warn about the cast anway. Avoid casting away constness to remove some picky compiler warnings.
@codecov
Copy link

codecov bot commented Sep 13, 2023

Codecov Report

Merging #821 (cec64c2) into master (46e68f7) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #821   +/-   ##
=======================================
  Coverage   93.65%   93.65%           
=======================================
  Files         191      191           
  Lines       46208    46208           
=======================================
  Hits        43276    43276           
  Misses       2932     2932           
Files Changed Coverage
include/slang/util/SmallVector.h 100.00%

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 46e68f7...cec64c2. Read the comment docs.

@MikePopoloski MikePopoloski merged commit 099882f into MikePopoloski:master Sep 14, 2023
17 checks passed
jameshanlon added a commit to jameshanlon/slang that referenced this pull request Sep 16, 2023
* master:
  Add checking for streaming operators that produce values larger than the maximum object size
  Type::getBitstreamWidth can now return a uint32_t, no possibility for overflow
  Rename bitstreamWidth -> getBitstreamWidth
  Enforce bitstream width limits for classes inside structs, unpacked arrays
  SmallVector.h: avoid casting away constness (MikePopoloski#821)
  Win32: add missing manifest to tool unittest executables
  Fix gcc + clang warnings
  chore: update pre-commit hooks (MikePopoloski#820)
  Tweak message for ObjectTooLarge diagnostic
  Error if a declared class type is too large
  Remove unreachable diagnostic path for bits of dynamic type
  Remove wchar special cases for Windows now that it can use UTF-8 as the active code page
  Win32: add a manifest to set the active code page to utf-8
@tdp2110 tdp2110 deleted the rm-const-cast branch June 25, 2024 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants