Skip to content

Commit

Permalink
GCC12: Convert array comparisons to pointer-to-first-element comparis…
Browse files Browse the repository at this point in the history
…ons.

These are equivalent, but the former is deprecated in C++20 and warned by GCC12.

[The above message is from an earlier equivalent commit in FlashFloppy.
It is also equivalent to part of PR #5 created by kimstik@github]
  • Loading branch information
keirf committed Oct 3, 2023
1 parent 12c2c35 commit 2d1a142
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/blinky.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ int main(void)
unsigned int nr_tim = 4;

/* Relocate DATA. Initialise BSS. */
if (_sdat != _ldat)
if (&_sdat[0] != &_ldat[0])
memcpy(_sdat, _ldat, _edat-_sdat);
memset(_sbss, 0, _ebss-_sbss);

Expand Down
2 changes: 1 addition & 1 deletion src/fw_update.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ static bool_t enter_bootloader(void)
int main(void)
{
/* Relocate DATA. Initialise BSS. */
if (_sdat != _ldat)
if (&_sdat[0] != &_ldat[0])
memcpy(_sdat, _ldat, _edat-_sdat);
memset(_sbss, 0, _ebss-_sbss);

Expand Down
2 changes: 1 addition & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ static void canary_check(void)
int main(void)
{
/* Relocate DATA. Initialise BSS. */
if (_sdat != _ldat)
if (&_sdat[0] != &_ldat[0])
memcpy(_sdat, _ldat, _edat-_sdat);
memset(_sbss, 0, _ebss-_sbss);

Expand Down

0 comments on commit 2d1a142

Please sign in to comment.