summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2023-07-30 22:22:52 (EDT)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2023-07-30 22:22:52 (EDT)
commit8042464eb99542c9421a98cce16164a55d0766ac (patch)
treea2ffc440b550ca127f3e1f70d069a9de9d2d647c
parentbdc69e3dedf933808062141c999b4ec5531a7e00 (diff)
opk/read: Only ignore analyzer warnings in new GCC
https://gcc.gnu.org/wiki/StaticAnalyzer Fixes the following warnings with older GCC versions: opkg-opk/opk/read.c: In function ‘_opkg_opk_opk_read_control’: opkg-opk/opk/read.c:159:5: warning: unknown option after ‘#pragma GCC diagnostic’ kind [-Wpragmas] "-Wanalyzer-use-of-uninitialized-value" ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ opkg-opk/opk/read.c:187:6: warning: unknown option after ‘#pragma GCC diagnostic’ kind [-Wpragmas] "-Wanalyzer-use-of-uninitialized-value" ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ opkg-opk/opk/read.c:198:5: warning: unknown option after ‘#pragma GCC diagnostic’ kind [-Wpragmas] "-Wanalyzer-use-of-uninitialized-value" ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ opkg-opk/opk/read.c:222:6: warning: unknown option after ‘#pragma GCC diagnostic’ kind [-Wpragmas] "-Wanalyzer-use-of-uninitialized-value" ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ opkg-opk/opk/read.c:265:5: warning: unknown option after ‘#pragma GCC diagnostic’ kind [-Wpragmas] "-Wanalyzer-use-of-uninitialized-value" ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ opkg-opk/opk/read.c:282:6: warning: unknown option after ‘#pragma GCC diagnostic’ kind [-Wpragmas] "-Wanalyzer-use-of-uninitialized-value" ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ opkg-opk/opk/read.c:290:35: warning: unknown option after ‘#pragma GCC diagnostic’ kind [-Wpragmas] # pragma GCC diagnostic ignored "-Wanalyzer-file-leak" ^~~~~~~~~~~~~~~~~~~~~~ opkg-opk/opk/read.c:300:5: warning: unknown option after ‘#pragma GCC diagnostic’ kind [-Wpragmas] "-Wanalyzer-use-of-uninitialized-value" ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ opkg-opk/opk/read.c:313:4: warning: unknown option after ‘#pragma GCC diagnostic’ kind [-Wpragmas] "-Wanalyzer-use-of-uninitialized-value" ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-rw-r--r--opkg-opk/opk/read.c47
1 files changed, 33 insertions, 14 deletions
diff --git a/opkg-opk/opk/read.c b/opkg-opk/opk/read.c
index ba86c93..7f5b3dd 100644
--- a/opkg-opk/opk/read.c
+++ b/opkg-opk/opk/read.c
@@ -155,8 +155,10 @@ _opkg_opk_opk_read_control(struct opkg_opk_opk *opk)
if (_opkg_opk_opk_read_init_inner(opk) != OPKG_OPK_OK) {
if (opk->control_dir != NULL) {
# pragma GCC diagnostic push
-# pragma GCC diagnostic ignored \
- "-Wanalyzer-use-of-uninitialized-value"
+# if __GNUC__ >= 11
+# pragma GCC diagnostic ignored \
+ "-Wanalyzer-use-of-uninitialized-value"
+# endif
free(path);
# pragma GCC diagnostic pop
}
@@ -183,8 +185,10 @@ _opkg_opk_opk_read_control(struct opkg_opk_opk *opk)
_opkg_opk_opk_read_free_inner(opk);
if (opk->control_dir != NULL) {
# pragma GCC diagnostic push
-# pragma GCC diagnostic ignored \
+# if __GNUC__ >= 11
+# pragma GCC diagnostic ignored \
"-Wanalyzer-use-of-uninitialized-value"
+# endif
free(path);
# pragma GCC diagnostic pop
}
@@ -194,8 +198,10 @@ _opkg_opk_opk_read_control(struct opkg_opk_opk *opk)
/* Open file for extraction. */
if (opk->control_dir != NULL) {
# pragma GCC diagnostic push
-# pragma GCC diagnostic ignored \
- "-Wanalyzer-use-of-uninitialized-value"
+# if __GNUC__ >= 11
+# pragma GCC diagnostic ignored \
+ "-Wanalyzer-use-of-uninitialized-value"
+# endif
if (sprintf(path, "%s/%s", opk->control_dir,
member->name) <= 0) {
opkg_opk_ustar_member_free(member);
@@ -218,8 +224,10 @@ _opkg_opk_opk_read_control(struct opkg_opk_opk *opk)
opkg_opk_ustar_member_free(member);
_opkg_opk_opk_read_free_inner(opk);
# pragma GCC diagnostic push
-# pragma GCC diagnostic ignored \
+# if __GNUC__ >= 11
+# pragma GCC diagnostic ignored \
"-Wanalyzer-use-of-uninitialized-value"
+# endif
free(path);
# pragma GCC diagnostic pop
return OPKG_OPK_ERROR;
@@ -261,8 +269,10 @@ _opkg_opk_opk_read_control(struct opkg_opk_opk *opk)
return OPKG_OPK_ERROR;
}
# pragma GCC diagnostic push
-# pragma GCC diagnostic ignored \
- "-Wanalyzer-use-of-uninitialized-value"
+# if __GNUC__ >= 11
+# pragma GCC diagnostic ignored \
+ "-Wanalyzer-use-of-uninitialized-value"
+# endif
if (opk->control_dir != NULL && fwrite(buffer, 1, size,
fp) != size) {
opkg_opk_error(_("Failed to write control file")
@@ -278,8 +288,10 @@ _opkg_opk_opk_read_control(struct opkg_opk_opk *opk)
_opkg_opk_opk_read_free_inner(opk);
if (opk->control_dir != NULL) {
# pragma GCC diagnostic push
-# pragma GCC diagnostic ignored \
+# if __GNUC__ >= 11
+# pragma GCC diagnostic ignored \
"-Wanalyzer-use-of-uninitialized-value"
+# endif
# pragma GCC diagnostic ignored \
"-Wmaybe-uninitialized"
free(path);
@@ -287,7 +299,10 @@ _opkg_opk_opk_read_control(struct opkg_opk_opk *opk)
# pragma GCC diagnostic pop
}
# pragma GCC diagnostic push
-# pragma GCC diagnostic ignored "-Wanalyzer-file-leak"
+# if __GNUC__ >= 10
+# pragma GCC diagnostic ignored \
+ "-Wanalyzer-file-leak"
+# endif
return OPKG_OPK_ERROR;
# pragma GCC diagnostic pop
}
@@ -296,8 +311,10 @@ _opkg_opk_opk_read_control(struct opkg_opk_opk *opk)
/* Close file for extraction. */
if (opk->control_dir != NULL) {
# pragma GCC diagnostic push
-# pragma GCC diagnostic ignored \
- "-Wanalyzer-use-of-uninitialized-value"
+# if __GNUC__ >= 11
+# pragma GCC diagnostic ignored \
+ "-Wanalyzer-use-of-uninitialized-value"
+# endif
if (fclose(fp) != 0) {
_opkg_opk_opk_read_free_inner(opk);
free(path);
@@ -309,8 +326,10 @@ _opkg_opk_opk_read_control(struct opkg_opk_opk *opk)
if (opk->control_dir != NULL) {
/* Done with path buffer. */
# pragma GCC diagnostic push
-# pragma GCC diagnostic ignored \
- "-Wanalyzer-use-of-uninitialized-value"
+# if __GNUC__ >= 11
+# pragma GCC diagnostic ignored \
+ "-Wanalyzer-use-of-uninitialized-value"
+# endif
# pragma GCC diagnostic ignored \
"-Wmaybe-uninitialized"
free(path);