From d9454f11d579af0f2cdd8141fb07ee73af4951fd Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Sun, 17 May 2020 21:25:27 -0400 Subject: bookmark: Disable -Wformat-truncation around create_bookmark() GCC 7 and up complain about this false positive when -Wformat-truncation or -D_FORTIFY_SOURCE is turned on. Primarily affects simulator builds on hosts with strict defaults. Change-Id: I385b3c247775e1268b6bbd326b1afc3eb5453db7 --- apps/bookmark.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'apps') diff --git a/apps/bookmark.c b/apps/bookmark.c index 1860d5737b..c07e2feb70 100644 --- a/apps/bookmark.c +++ b/apps/bookmark.c @@ -372,7 +372,13 @@ static bool add_bookmark(const char* bookmark_file_name, const char* bookmark, return true; } - +/* GCC 7 and up complain about the snprintf in create_bookmark() when + compiled with -D_FORTIFY_SOURCE or -Wformat-truncation + This is a false positive, so disable it here only */ +#pragma GCC diagnostic push +#if __GNUC__ >= 7 +#pragma GCC diagnostic ignored "-Wformat-truncation" +#endif /* ----------------------------------------------------------------------- */ /* This function takes the system resume data and formats it into a valid */ /* bookmark. */ @@ -441,6 +447,7 @@ static char* create_bookmark() else return NULL; } +#pragma GCC diagnostic pop /* -Wformat-truncation */ /* ----------------------------------------------------------------------- */ /* This function will determine if an autoload is necessary. This is an */ -- cgit v1.2.3