Fix Build Warnings for AArch64 (#2242)

This commit links to issue (#2234).

When cross-compiling for AArch64, using gcc 13.3, you encounter three
warnings types that turn into errors:

- maybe-uninitialized
- stringop-truncation
- strict-aliasing

This commit fixes all the warnings found, in regards to the first two
rules. To resolve the warnigns due to strict-aliasing, I am editing the
CMake build system.

Signed-off-by: Antonios Christidis <a-christidis@ti.com>
This commit is contained in:
Antonios Christidis
2025-02-05 06:58:17 -06:00
committed by GitHub
parent bcfa1f7c26
commit 2031e21a58
30 changed files with 104 additions and 43 deletions

View File

@@ -365,16 +365,18 @@ static int ParseArgs( int argc, const char **argv )
int length_of_seed = 0;
{ // Extract the app name
strncpy( appName, argv[0], MAXPATHLEN );
strncpy(appName, argv[0], MAXPATHLEN - 1);
appName[MAXPATHLEN - 1] = '\0';
#if (defined( __APPLE__ ) || defined(__linux__) || defined(__MINGW32__))
char baseName[MAXPATHLEN];
char *base = NULL;
strncpy( baseName, argv[0], MAXPATHLEN );
strncpy(baseName, argv[0], MAXPATHLEN - 1);
baseName[MAXPATHLEN - 1] = '\0';
base = basename( baseName );
if( NULL != base )
{
strncpy( appName, base, sizeof( appName ) );
strncpy(appName, base, sizeof(appName) - 1);
appName[ sizeof( appName ) -1 ] = '\0';
}
#elif defined (_WIN32)
@@ -385,7 +387,7 @@ static int ParseArgs( int argc, const char **argv )
fname, _MAX_FNAME, ext, _MAX_EXT );
if (err == 0) { // no error
strcat (fname, ext); //just cat them, size of frame can keep both
strncpy (appName, fname, sizeof(appName));
strncpy(appName, fname, sizeof(appName) - 1);
appName[ sizeof( appName ) -1 ] = '\0';
}
#endif