Skip to content

Fix build warnings on Linux#924

Open
davidhealey wants to merge 1 commit intochristophhart:developfrom
davidhealey:fixLinkerWarnings
Open

Fix build warnings on Linux#924
davidhealey wants to merge 1 commit intochristophhart:developfrom
davidhealey:fixLinkerWarnings

Conversation

@davidhealey
Copy link
Copy Markdown
Contributor

Add required 'template' keyword before dependent template name when calling p.connect

(dst) where p is a dependent expression.

https://claude.ai/code/session_011oaJHUxVahg6svtz22UgD2

Fix Linux build warnings in RestHelpers.cpp and mir-gen.c

  • Remove apostrophe from comment in #if 0 block in RestHelpers.cpp to fix "missing terminating ' character" tokenizer warning
  • Add #undef DEBUG before redefining it in mir-gen.c to fix "DEBUG redefined" warning caused by command-line -DDEBUG definition

https://claude.ai/code/session_01QKATiMNcmsfMd3cEn4Z4S8

Fix Linux -Wreturn-type warnings in snex by marking throw functions [[noreturn]]

Mark CodeLocation::throwError, TokenIterator::throwTokenMismatch, and Operations::Statement::throwError as [[noreturn]] since they always throw. This fixes four GCC -Wreturn-type warnings caused by RETURN_DEBUG_ONLY expanding to nothing in release builds, leaving no return statement after the always-throwing calls.

https://claude.ai/code/session_01QKATiMNcmsfMd3cEn4Z4S8

Fix GCC -Wstringop-overflow warning in stb_image.h

Change tc[3] to tc[4] in stbi__parse_png_file. GCC warns because the loop iterates up to s->img_n times, and img_n can be 4. The guard (s->img_n & 1) means only odd values (1 or 3) reach this code path, so tc[3] is safe in practice, but enlarging to tc[4] silences the false-positive warning.

https://claude.ai/code/session_01QKATiMNcmsfMd3cEn4Z4S8

Fix out-of-bounds write to currentNotes[] in ModulatorSampler

getNoteNumber() + getTransposeAmount() can exceed [0,127] when a transpose is applied, writing beyond the end of the 128-element currentNotes array (UB flagged by -Waggressive-loop-optimizations, iteration 127). Apply jlimit(0, 127, ...) consistent with the existing bounds check in resetNoteDisplay().

The repeated -Wfree-nonheap-object 'emptyString' warnings are a GCC false positive in JUCE's StringHolder::release(): the check against the static emptyString pointer is logically correct but not visible to the optimiser after inlining. The fix is to restructure that function to use an early return when b == &emptyString so the delete[] path is in a clearly separate branch. This requires modifying juce_String.cpp in the JUCE submodule (christophhart/JUCE_customized, juce6 branch).

https://claude.ai/code/session_01QKATiMNcmsfMd3cEn4Z4S8

Fix off-by-one in noteColours array causing -Waggressive-loop-optimizations

Array was declared as [127] but accessed with indices 0-127 (128 elements). Iteration 127 was UB; correct size is [128].

https://claude.ai/code/session_01QKATiMNcmsfMd3cEn4Z4S8

Fix -Wstringop-overflow in memcpy call in getBitReductionForDifferential

Cast b.size to size_t before multiplying to prevent GCC from inferring a potentially-negative signed int being passed as memcpy's size argument.

https://claude.ai/code/session_01QKATiMNcmsfMd3cEn4Z4S8

Add required 'template' keyword before dependent template name when calling
p.connect<P>(dst) where p is a dependent expression.

https://claude.ai/code/session_011oaJHUxVahg6svtz22UgD2

Fix Linux build warnings in RestHelpers.cpp and mir-gen.c

- Remove apostrophe from comment in #if 0 block in RestHelpers.cpp to
  fix "missing terminating ' character" tokenizer warning
- Add #undef DEBUG before redefining it in mir-gen.c to fix
  "DEBUG redefined" warning caused by command-line -DDEBUG definition

https://claude.ai/code/session_01QKATiMNcmsfMd3cEn4Z4S8

Fix Linux -Wreturn-type warnings in snex by marking throw functions [[noreturn]]

Mark CodeLocation::throwError, TokenIterator::throwTokenMismatch, and
Operations::Statement::throwError as [[noreturn]] since they always throw.
This fixes four GCC -Wreturn-type warnings caused by RETURN_DEBUG_ONLY
expanding to nothing in release builds, leaving no return statement after
the always-throwing calls.

https://claude.ai/code/session_01QKATiMNcmsfMd3cEn4Z4S8

Fix GCC -Wstringop-overflow warning in stb_image.h

Change tc[3] to tc[4] in stbi__parse_png_file. GCC warns because the
loop iterates up to s->img_n times, and img_n can be 4. The guard
(s->img_n & 1) means only odd values (1 or 3) reach this code path,
so tc[3] is safe in practice, but enlarging to tc[4] silences the
false-positive warning.

https://claude.ai/code/session_01QKATiMNcmsfMd3cEn4Z4S8

Fix out-of-bounds write to currentNotes[] in ModulatorSampler

getNoteNumber() + getTransposeAmount() can exceed [0,127] when a
transpose is applied, writing beyond the end of the 128-element
currentNotes array (UB flagged by -Waggressive-loop-optimizations,
iteration 127). Apply jlimit(0, 127, ...) consistent with the existing
bounds check in resetNoteDisplay().

The repeated -Wfree-nonheap-object 'emptyString' warnings are a GCC
false positive in JUCE's StringHolder::release(): the check against the
static emptyString pointer is logically correct but not visible to the
optimiser after inlining. The fix is to restructure that function to use
an early return when b == &emptyString so the delete[] path is in a
clearly separate branch. This requires modifying juce_String.cpp in the
JUCE submodule (christophhart/JUCE_customized, juce6 branch).

https://claude.ai/code/session_01QKATiMNcmsfMd3cEn4Z4S8

Fix off-by-one in noteColours array causing -Waggressive-loop-optimizations

Array was declared as [127] but accessed with indices 0-127 (128 elements).
Iteration 127 was UB; correct size is [128].

https://claude.ai/code/session_01QKATiMNcmsfMd3cEn4Z4S8

Fix -Wstringop-overflow in memcpy call in getBitReductionForDifferential

Cast b.size to size_t before multiplying to prevent GCC from inferring
a potentially-negative signed int being passed as memcpy's size argument.

https://claude.ai/code/session_01QKATiMNcmsfMd3cEn4Z4S8
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