mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -04:00
misc: Correct various -Wunterminated-string-initialization warnings
-Wunterminates-string-initialization will complain if we try to shove a "string" into a fixed array that is too small. Sometimes this is intentional; when you are merely using "string" as a standin for "non-terminated sequence of bytes". In these cases we need to mark the "string" as "not actually a string" with an attribute. Applies to GCC >=8, but this warning isn't pulled in by -Wextra until GCC >= 15. Change-Id: Ib94410a22f4587940b16cf03d539fbadc3373686
This commit is contained in:
parent
c65050571e
commit
180753ce0a
6 changed files with 57 additions and 49 deletions
|
@ -737,7 +737,7 @@ void D_DoomMainSetup(void)
|
|||
{
|
||||
// These are the lumps that will be checked in IWAD,
|
||||
// if any one is not present, execution will be aborted.
|
||||
const char name[23][8]=
|
||||
const char name[23][9] =
|
||||
{
|
||||
"e2m1","e2m2","e2m3","e2m4","e2m5","e2m6","e2m7","e2m8","e2m9",
|
||||
"e3m1","e3m3","e3m3","e3m4","e3m5","e3m6","e3m7","e3m8","e3m9",
|
||||
|
|
|
@ -199,7 +199,7 @@ void init_memory (void)
|
|||
static struct {
|
||||
enum story story_id;
|
||||
zword release;
|
||||
zbyte serial[6];
|
||||
zbyte serial[6] __NONSTRING;
|
||||
} records[] = {
|
||||
{ SHERLOCK, 21, "871214" },
|
||||
{ SHERLOCK, 26, "880127" },
|
||||
|
|
|
@ -29,7 +29,7 @@ struct svar
|
|||
int len;
|
||||
union
|
||||
{
|
||||
char key_[4];
|
||||
char _key[4] __NONSTRING;
|
||||
un32 key;
|
||||
} k;
|
||||
void *ptr;
|
||||
|
|
|
@ -56,15 +56,12 @@
|
|||
/***************************************************************************
|
||||
* TODO: Implement a merge sort for files larger than the buffer
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
|
||||
size_t buf_size;
|
||||
static char *filename;
|
||||
static int num_entries;
|
||||
static char **pointers;
|
||||
static char *stringbuffer;
|
||||
static char crlf[2] = "\r\n";
|
||||
static char crlf[2] __NONSTRING = "\r\n";
|
||||
static int bomsize;
|
||||
|
||||
/* Compare function for sorting backwards */
|
||||
|
|
|
@ -527,11 +527,11 @@ static bool save_sudoku(struct sudoku_state_t* state)
|
|||
int i;
|
||||
#ifdef SUDOKU_BUTTON_POSSIBLE
|
||||
int x;
|
||||
char line[41]="...|...|... ; \r\n";
|
||||
char line[41] __NONSTRING ="...|...|... ; \r\n";
|
||||
#else
|
||||
char line[13]="...|...|...\r\n";
|
||||
char line[13] __NONSTRING = "...|...|...\r\n";
|
||||
#endif
|
||||
char sep[13]="-----------\r\n";
|
||||
char sep[13]__NONSTRING = "-----------\r\n";
|
||||
|
||||
rb->splash(0, "Saving...");
|
||||
|
||||
|
|
|
@ -1070,6 +1070,17 @@ Lyre prototype 1 */
|
|||
#define ROCKBOX_STRICT_ALIGN 1
|
||||
#endif
|
||||
|
||||
/* -Wunterminates-string-initialization will complain if we try to shove
|
||||
a "string" into an array that is too small. Sometimes this actually
|
||||
intentional, where you are merely using "string" as a standin for
|
||||
"non-terminated sequence of bytes" -- in which case we need to mark
|
||||
the "string" as "not actually a string" with an attribute. Applies to
|
||||
GCC >=8, but this warning isn't pulled in by -Wextra until >= 15.
|
||||
*/
|
||||
#if __GNUC__ >= 8
|
||||
#define __NONSTRING __attribute__((__nonstring__))
|
||||
#endif
|
||||
|
||||
/*
|
||||
* These macros are for switching on unified syntax in inline assembly.
|
||||
* Older versions of GCC emit assembly in divided syntax with no option
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue