aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2024-07-10 17:45:35 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2024-07-10 17:45:35 +0000
commita5d8c86fe649f0ce0b19725cb2e9cc1182a288e3 (patch)
tree93128622a07adee9de28679719da86af4a23c73b
parentbedc97505f02eeee38cbc4386a450233c64d2bee (diff)
devel/freebsd-gcc*: Fix error in printf0 format checker patch
Fix a mismerge of the printf0 format checking patch from GCC 9 to GCC 12/13. GCC 11 and later don't warn for NULL format strings (instead a separate nonnull attribute is used). The printf0 format specifier is left for now to support builds of existing FreeBSD releases but will be removed in the future. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D45941
-rw-r--r--devel/freebsd-gcc12/Makefile2
-rw-r--r--devel/freebsd-gcc12/files/patch-freebsd-format-extensions28
-rw-r--r--devel/freebsd-gcc13/Makefile2
-rw-r--r--devel/freebsd-gcc13/files/patch-freebsd-format-extensions28
4 files changed, 4 insertions, 56 deletions
diff --git a/devel/freebsd-gcc12/Makefile b/devel/freebsd-gcc12/Makefile
index 1de4cce9c92f..9d0d604194f8 100644
--- a/devel/freebsd-gcc12/Makefile
+++ b/devel/freebsd-gcc12/Makefile
@@ -1,6 +1,6 @@
PORTNAME= gcc
DISTVERSION= 12.3.0
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= devel
MASTER_SITES= GCC
PKGNAMEPREFIX= ${TARGETARCH}-
diff --git a/devel/freebsd-gcc12/files/patch-freebsd-format-extensions b/devel/freebsd-gcc12/files/patch-freebsd-format-extensions
index 7bce7950c4db..246dcb276ba3 100644
--- a/devel/freebsd-gcc12/files/patch-freebsd-format-extensions
+++ b/devel/freebsd-gcc12/files/patch-freebsd-format-extensions
@@ -67,7 +67,7 @@
+ },
+ { "printf0", printf_length_specs, print_char_table, " +#0-'I", NULL,
+ printf_flag_specs, printf_flag_pairs,
-+ FMT_FLAG_ARG_CONVERT|FMT_FLAG_DOLLAR_MULTIPLE|FMT_FLAG_USE_DOLLAR|FMT_FLAG_EMPTY_PREC_OK|FMT_FLAG_NULL_FORMAT_OK,
++ FMT_FLAG_ARG_CONVERT|FMT_FLAG_DOLLAR_MULTIPLE|FMT_FLAG_USE_DOLLAR|FMT_FLAG_EMPTY_PREC_OK,
+ 'w', 0, 'p', 0, 'L', 0,
+ &integer_type_node, &integer_type_node
+ },
@@ -79,29 +79,3 @@
}
};
-@@ -1635,6 +1693,9 @@ check_format_arg (void *ctx, tree format_tree,
-
- if (integer_zerop (format_tree))
- {
-+ if (!(format_types[info->format_type].flags & FMT_FLAG_NULL_FORMAT_OK))
-+ warning (OPT_Wformat_, "null format string");
-+
- /* Skip to first argument to check, so we can see if this format
- has any arguments (it shouldn't). */
- while (arg_num + 1 < info->first_arg_num)
---- gcc/c-family/c-format.h.orig 2022-05-06 00:30:56.000000000 -0700
-+++ gcc/c-family/c-format.h 2022-11-17 17:31:38.546594000 -0800
-@@ -77,11 +77,12 @@ enum
- FMT_FLAG_DOLLAR_GAP_POINTER_OK = 128,
- /* The format arg is an opaque object that will be parsed by an external
- facility. */
-- FMT_FLAG_PARSE_ARG_CONVERT_EXTERNAL = 256
-+ FMT_FLAG_PARSE_ARG_CONVERT_EXTERNAL = 256,
- /* Not included here: details of whether width or precision may occur
- (controlled by width_char and precision_char); details of whether
- '*' can be used for these (width_type and precision_type); details
- of whether length modifiers can occur (length_char_specs). */
-+ FMT_FLAG_NULL_FORMAT_OK = 512
- };
-
- /* Structure describing a length modifier supported in format checking, and
diff --git a/devel/freebsd-gcc13/Makefile b/devel/freebsd-gcc13/Makefile
index b7536f2e7bdf..f08ead54f058 100644
--- a/devel/freebsd-gcc13/Makefile
+++ b/devel/freebsd-gcc13/Makefile
@@ -1,6 +1,6 @@
PORTNAME= gcc
DISTVERSION= 13.2.0
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= devel
MASTER_SITES= GCC
PKGNAMEPREFIX= ${TARGETARCH}-
diff --git a/devel/freebsd-gcc13/files/patch-freebsd-format-extensions b/devel/freebsd-gcc13/files/patch-freebsd-format-extensions
index 7bce7950c4db..246dcb276ba3 100644
--- a/devel/freebsd-gcc13/files/patch-freebsd-format-extensions
+++ b/devel/freebsd-gcc13/files/patch-freebsd-format-extensions
@@ -67,7 +67,7 @@
+ },
+ { "printf0", printf_length_specs, print_char_table, " +#0-'I", NULL,
+ printf_flag_specs, printf_flag_pairs,
-+ FMT_FLAG_ARG_CONVERT|FMT_FLAG_DOLLAR_MULTIPLE|FMT_FLAG_USE_DOLLAR|FMT_FLAG_EMPTY_PREC_OK|FMT_FLAG_NULL_FORMAT_OK,
++ FMT_FLAG_ARG_CONVERT|FMT_FLAG_DOLLAR_MULTIPLE|FMT_FLAG_USE_DOLLAR|FMT_FLAG_EMPTY_PREC_OK,
+ 'w', 0, 'p', 0, 'L', 0,
+ &integer_type_node, &integer_type_node
+ },
@@ -79,29 +79,3 @@
}
};
-@@ -1635,6 +1693,9 @@ check_format_arg (void *ctx, tree format_tree,
-
- if (integer_zerop (format_tree))
- {
-+ if (!(format_types[info->format_type].flags & FMT_FLAG_NULL_FORMAT_OK))
-+ warning (OPT_Wformat_, "null format string");
-+
- /* Skip to first argument to check, so we can see if this format
- has any arguments (it shouldn't). */
- while (arg_num + 1 < info->first_arg_num)
---- gcc/c-family/c-format.h.orig 2022-05-06 00:30:56.000000000 -0700
-+++ gcc/c-family/c-format.h 2022-11-17 17:31:38.546594000 -0800
-@@ -77,11 +77,12 @@ enum
- FMT_FLAG_DOLLAR_GAP_POINTER_OK = 128,
- /* The format arg is an opaque object that will be parsed by an external
- facility. */
-- FMT_FLAG_PARSE_ARG_CONVERT_EXTERNAL = 256
-+ FMT_FLAG_PARSE_ARG_CONVERT_EXTERNAL = 256,
- /* Not included here: details of whether width or precision may occur
- (controlled by width_char and precision_char); details of whether
- '*' can be used for these (width_type and precision_type); details
- of whether length modifiers can occur (length_char_specs). */
-+ FMT_FLAG_NULL_FORMAT_OK = 512
- };
-
- /* Structure describing a length modifier supported in format checking, and