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,132 +1,132 @@ PORTNAME= gcc DISTVERSION= 12.3.0 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= devel MASTER_SITES= GCC PKGNAMEPREFIX= ${TARGETARCH}- PKGNAMESUFFIX= ${SUFFIX} MAINTAINER= jhb@FreeBSD.org COMMENT= Cross GNU Compiler ${SUFFIX} for FreeBSD/${TARGETARCH} WWW= https://gcc.gnu.org/ LICENSE= GPLv3 GPLv3RLE LICENSE_COMB= multi BUILD_DEPENDS= ${BU_PREFIX}-as:devel/binutils@${BU_FLAVOR} \ objdump:devel/binutils LIB_DEPENDS= libgmp.so:math/gmp \ libmpfr.so:math/mpfr \ libmpc.so:math/mpc RUN_DEPENDS= ${BU_PREFIX}-as:devel/binutils@${BU_FLAVOR} FLAVORS= aarch64 amd64 armv6 armv7 i386 powerpc powerpc64 riscv64 TARGETARCH= ${FLAVOR} USES= compiler:c++11-lang cpe gmake iconv libtool makeinfo tar:xz CPE_VENDOR= gnu PLIST_SUB= OPSYS=${OPSYS:tl} \ SUFFIX=${SUFFIX} \ TARGETARCH=${TARGETARCH} \ GCC_TARGET=${GCC_TARGET} \ GCC_VERSION=${PORTVERSION} SUB_FILES= xtoolchain.mk SUB_LIST= BU_PREFIX=${BU_PREFIX} \ GCC_TARGET=${GCC_TARGET} \ SUFFIX=${SUFFIX} SUFFIX= ${PORTVERSION:C/([0-9]+).*/\1/} GNU_CONFIGURE= yes GNU_CONFIGURE_MANPREFIX=${PREFIX}/share CONFIGURE_OUTSOURCE= yes CONFIGURE_ARGS+=--target=${GCC_TARGET} --disable-nls --enable-languages=c,c++ \ --enable-gnu-indirect-function \ --enable-initfini-array \ --program-prefix=${GCC_TARGET}- \ --program-suffix=${SUFFIX} \ --without-headers \ --with-gmp=${LOCALBASE} \ --with-pkgversion="FreeBSD Ports Collection for ${PKGNAMEPREFIX:C/-//g}" \ --with-system-zlib \ --without-zstd \ --with-gxx-libcxx-include-dir=//usr/include/c++/v1 \ --with-sysroot="/" \ --with-as=${LOCALBASE}/bin/${BU_PREFIX}-as \ --with-ld=${LOCALBASE}/bin/${BU_PREFIX}-ld .if ${TARGETARCH:Mpowerpc64*} CONFIGURE_ARGS+=--with-abi=elfv2 .endif CPPFLAGS+= -DLIBCXXABI=NULL ALL_TARGET= all-gcc INSTALL_TARGET= install-gcc .include .if ${TARGETARCH:Marm*} TARGET_ABI= gnueabi BU_FLAVOR= arm_${TARGET_ABI} BU_PREFIX= arm-${TARGET_ABI}-${OPSYS:tl}${OSREL} .else TARGET_ABI= unknown BU_FLAVOR= ${TARGETARCH} BU_PREFIX= ${GCC_TARGET} .endif GCC_TARGET= ${TARGETARCH:S/amd64/x86_64/}-${TARGET_ABI}-${OPSYS:tl}${OSREL} post-patch: @${REINPLACE_CMD} -e '/LOCAL_INCLUDE_DIR/ d ' \ ${WRKSRC}//gcc/Makefile.in .if ${ARCH} == "amd64" CONFIGURE_TARGET= x86_64-unknown-${OPSYS:tl}${OSREL} .else CONFIGURE_TARGET= ${ARCH}-unknown-${OPSYS:tl}${OSREL} .endif .if ${TARGETARCH} == "amd64" || ${TARGETARCH} == "powerpc64" CONFIGURE_ARGS+=--enable-multilib .endif .if ${ARCH} == "aarch64" PLIST_SUB+= PLUGINS="@comment plugin does not build" .else PLIST_SUB+= PLUGINS="" .endif .if ${TARGETARCH} == "amd64" || ${TARGETARCH} == "i386" PLIST_SUB+= FLOAT_H="@comment " .else PLIST_SUB+= FLOAT_H="" .endif PLIST= ${.CURDIR}/pkg-plist PLISTARCH= ${TARGETARCH:C/armv[67]/arm_gnueabi/} PLIST+= ${.CURDIR}/pkg-plist.${PLISTARCH} .if ${TARGETARCH} == "aarch64" || ${TARGETARCH:Marm*} PLIST+= ${.CURDIR}/pkg-plist.arm .endif .if ${TARGETARCH} == "amd64" PLIST+= ${.CURDIR}/pkg-plist.i386 .endif post-install: ${RM} ${STAGEDIR}${PREFIX}/bin/${GCC_TARGET}-${GCC_TARGET}-* ${RM} ${STAGEDIR}${PREFIX}/share/info/* ${RM} ${STAGEDIR}${PREFIX}/share/man/man7/* ${RM} -r ${STAGEDIR}${PREFIX}/lib/gcc/${GCC_TARGET}/${PORTVERSION}/include-fixed .if ${TARGETARCH} == "amd64" || ${TARGETARCH} == "i386" # Conflicts with sys/x86/include/float.h ${RM} ${STAGEDIR}${PREFIX}/lib/gcc/${GCC_TARGET}/${PORTVERSION}/include/float.h .endif ${MKDIR} ${STAGEDIR}${PREFIX}/share/toolchains/ ${INSTALL_DATA} ${WRKDIR}/xtoolchain.mk \ ${STAGEDIR}${PREFIX}/share/toolchains/${TARGETARCH}-gcc${SUFFIX}.mk .include 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 @@ -1,107 +1,81 @@ --- gcc/c-family/c-format.cc.orig 2022-05-06 00:30:56.000000000 -0700 +++ gcc/c-family/c-format.cc 2022-11-18 11:27:29.832693000 -0800 @@ -496,6 +496,17 @@ static const format_length_info printf_length_specs[] { NO_FMT, NO_FMT, 0 } }; +static const format_length_info freebsd_kprintf_length_specs[] = +{ + { "h", FMT_LEN_h, STD_C89, "hh", FMT_LEN_hh, STD_C99, 0 }, + { "l", FMT_LEN_l, STD_C89, "ll", FMT_LEN_ll, STD_C9L, 0 }, + { "q", FMT_LEN_ll, STD_EXT, NO_FMT, 0 }, + { "z", FMT_LEN_z, STD_C99, NO_FMT, 0 }, + { "t", FMT_LEN_t, STD_C99, NO_FMT, 0 }, + { "j", FMT_LEN_j, STD_C99, NO_FMT, 0 }, + { NO_FMT, NO_FMT, 0 } +}; + /* Length specifiers valid for asm_fprintf. */ static const format_length_info asm_fprintf_length_specs[] = { @@ -721,6 +732,41 @@ static const format_char_info print_char_table[] = { NULL, 0, STD_C89, NOLENGTHS, NULL, NULL, NULL } }; +static const format_char_info freebsd_ext_char_info = +{ NULL, 1, STD_EXT, { T89_C, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "", "cR", NULL }; + +static const format_char_info freebsd_kprintf_char_table[] = +{ + /* C89 conversion specifiers. */ + { "di", 0, STD_C89, { T89_I, T99_SC, T89_S, T89_L, T9L_LL, TEX_LL, T99_SST, T99_PD, T99_IM, BADLEN, BADLEN, BADLEN }, "-wp0 +'I", "i", NULL }, + { "oxX", 0, STD_C89, { T89_UI, T99_UC, T89_US, T89_UL, T9L_ULL, TEX_ULL, T99_ST, T99_UPD, T99_UIM, BADLEN, BADLEN, BADLEN }, "-wp0#", "i", NULL }, + { "u", 0, STD_C89, { T89_UI, T99_UC, T89_US, T89_UL, T9L_ULL, TEX_ULL, T99_ST, T99_UPD, T99_UIM, BADLEN, BADLEN, BADLEN }, "-wp0'I", "i", NULL }, + { "fgG", 0, STD_C89, { T89_D, BADLEN, BADLEN, T99_D, BADLEN, T89_LD, BADLEN, BADLEN, BADLEN, T2X_D32, T2X_D64, T2X_D128 }, "-wp0 +#'I", "", NULL }, + { "eE", 0, STD_C89, { T89_D, BADLEN, BADLEN, T99_D, BADLEN, T89_LD, BADLEN, BADLEN, BADLEN, T2X_D32, T2X_D64, T2X_D128 }, "-wp0 +#I", "", NULL }, + { "c", 0, STD_C89, { T89_I, BADLEN, BADLEN, T94_WI, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-w", "", NULL }, + { "s", 1, STD_C89, { T89_C, BADLEN, BADLEN, T94_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp", "cR", NULL }, + { "p", 1, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-w", "c", NULL }, + { "n", 1, STD_C89, { T89_I, T99_SC, T89_S, T89_L, T9L_LL, BADLEN, T99_SST, T99_PD, T99_IM, BADLEN, BADLEN, BADLEN }, "", "W", NULL }, + /* C99 conversion specifiers. */ + { "F", 0, STD_C99, { T99_D, BADLEN, BADLEN, T99_D, BADLEN, T99_LD, BADLEN, BADLEN, BADLEN, T2X_D32, T2X_D64, T2X_D128 }, "-wp0 +#'I", "", NULL }, + { "aA", 0, STD_C99, { T99_D, BADLEN, BADLEN, T99_D, BADLEN, T99_LD, BADLEN, BADLEN, BADLEN, T2X_D32, T2X_D64, T2X_D128 }, "-wp0 +#", "", NULL }, + /* X/Open conversion specifiers. */ + { "C", 0, STD_EXT, { TEX_WI, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-w", "", NULL }, + { "S", 1, STD_EXT, { TEX_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp", "R", NULL }, + /* FreeBSD kernel extensions (src/sys/kern/subr_prf.c). + The format %b is supported to decode error registers. + Its usage is: printf("reg=%b\n", regval, "*"); + which produces: reg=3 + The format %D provides a hexdump given a pointer and separator string: + ("%6D", ptr, ":") -> XX:XX:XX:XX:XX:XX + ("%*D", len, ptr, " ") -> XX XX XX XX ... + */ + { "D", 1, STD_EXT, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp", "cR", &freebsd_ext_char_info }, + { "b", 0, STD_EXT, { T89_I, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp", "", &freebsd_ext_char_info }, + { "ry", 0, STD_EXT, { T89_I, BADLEN, BADLEN, T89_L, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp0 +#", "i", NULL }, + { NULL, 0, STD_C89, NOLENGTHS, NULL, NULL, NULL } +}; + static const format_char_info asm_fprintf_char_table[] = { /* C89 conversion specifiers. */ @@ -991,6 +1037,18 @@ static const format_kind_info format_types_orig[] = strfmon_flag_specs, strfmon_flag_pairs, FMT_FLAG_ARG_CONVERT, 'w', '#', 'p', 0, 'L', 0, NULL, NULL + }, + { "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 + }, + { "freebsd_kprintf", freebsd_kprintf_length_specs, freebsd_kprintf_char_table, " +#0-'", NULL, + printf_flag_specs, printf_flag_pairs, + 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 } }; -@@ -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,132 +1,132 @@ PORTNAME= gcc DISTVERSION= 13.2.0 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= devel MASTER_SITES= GCC PKGNAMEPREFIX= ${TARGETARCH}- PKGNAMESUFFIX= ${SUFFIX} MAINTAINER= jhb@FreeBSD.org COMMENT= Cross GNU Compiler ${SUFFIX} for FreeBSD/${TARGETARCH} WWW= https://gcc.gnu.org/ LICENSE= GPLv3 GPLv3RLE LICENSE_COMB= multi BUILD_DEPENDS= ${BU_PREFIX}-as:devel/binutils@${BU_FLAVOR} \ objdump:devel/binutils LIB_DEPENDS= libgmp.so:math/gmp \ libmpfr.so:math/mpfr \ libmpc.so:math/mpc RUN_DEPENDS= ${BU_PREFIX}-as:devel/binutils@${BU_FLAVOR} FLAVORS= aarch64 amd64 armv6 armv7 i386 powerpc powerpc64 riscv64 TARGETARCH= ${FLAVOR} USES= compiler:c++11-lang cpe gmake iconv libtool makeinfo tar:xz CPE_VENDOR= gnu PLIST_SUB= OPSYS=${OPSYS:tl} \ SUFFIX=${SUFFIX} \ TARGETARCH=${TARGETARCH} \ GCC_TARGET=${GCC_TARGET} \ GCC_VERSION=${PORTVERSION} SUB_FILES= xtoolchain.mk SUB_LIST= BU_PREFIX=${BU_PREFIX} \ GCC_TARGET=${GCC_TARGET} \ SUFFIX=${SUFFIX} SUFFIX= ${PORTVERSION:C/([0-9]+).*/\1/} GNU_CONFIGURE= yes GNU_CONFIGURE_MANPREFIX=${PREFIX}/share CONFIGURE_OUTSOURCE= yes CONFIGURE_ARGS+=--target=${GCC_TARGET} --disable-nls --enable-languages=c,c++ \ --enable-gnu-indirect-function \ --enable-initfini-array \ --program-prefix=${GCC_TARGET}- \ --program-suffix=${SUFFIX} \ --without-headers \ --with-gmp=${LOCALBASE} \ --with-pkgversion="FreeBSD Ports Collection for ${PKGNAMEPREFIX:C/-//g}" \ --with-system-zlib \ --without-zstd \ --with-gxx-libcxx-include-dir=//usr/include/c++/v1 \ --with-sysroot="/" \ --with-as=${LOCALBASE}/bin/${BU_PREFIX}-as \ --with-ld=${LOCALBASE}/bin/${BU_PREFIX}-ld .if ${TARGETARCH:Mpowerpc64*} CONFIGURE_ARGS+=--with-abi=elfv2 .endif CPPFLAGS+= -DLIBCXXABI=NULL ALL_TARGET= all-gcc INSTALL_TARGET= install-gcc .include .if ${TARGETARCH:Marm*} TARGET_ABI= gnueabi BU_FLAVOR= arm_${TARGET_ABI} BU_PREFIX= arm-${TARGET_ABI}-${OPSYS:tl}${OSREL} .else TARGET_ABI= unknown BU_FLAVOR= ${TARGETARCH} BU_PREFIX= ${GCC_TARGET} .endif GCC_TARGET= ${TARGETARCH:S/amd64/x86_64/}-${TARGET_ABI}-${OPSYS:tl}${OSREL} post-patch: @${REINPLACE_CMD} -e '/LOCAL_INCLUDE_DIR/ d ' \ ${WRKSRC}//gcc/Makefile.in .if ${ARCH} == "amd64" CONFIGURE_TARGET= x86_64-unknown-${OPSYS:tl}${OSREL} .else CONFIGURE_TARGET= ${ARCH}-unknown-${OPSYS:tl}${OSREL} .endif .if ${TARGETARCH} == "amd64" || ${TARGETARCH} == "powerpc64" CONFIGURE_ARGS+=--enable-multilib .endif .if ${ARCH} == "aarch64" PLIST_SUB+= PLUGINS="@comment plugin does not build" .else PLIST_SUB+= PLUGINS="" .endif .if ${TARGETARCH} == "amd64" || ${TARGETARCH} == "i386" PLIST_SUB+= FLOAT_H="@comment " .else PLIST_SUB+= FLOAT_H="" .endif PLIST= ${.CURDIR}/pkg-plist PLISTARCH= ${TARGETARCH:C/armv[67]/arm_gnueabi/} PLIST+= ${.CURDIR}/pkg-plist.${PLISTARCH} .if ${TARGETARCH} == "aarch64" || ${TARGETARCH:Marm*} PLIST+= ${.CURDIR}/pkg-plist.arm .endif .if ${TARGETARCH} == "amd64" PLIST+= ${.CURDIR}/pkg-plist.i386 .endif post-install: ${RM} ${STAGEDIR}${PREFIX}/bin/${GCC_TARGET}-${GCC_TARGET}-* ${RM} ${STAGEDIR}${PREFIX}/share/info/* ${RM} ${STAGEDIR}${PREFIX}/share/man/man7/* ${RM} -r ${STAGEDIR}${PREFIX}/lib/gcc/${GCC_TARGET}/${PORTVERSION}/include-fixed .if ${TARGETARCH} == "amd64" || ${TARGETARCH} == "i386" # Conflicts with sys/x86/include/float.h ${RM} ${STAGEDIR}${PREFIX}/lib/gcc/${GCC_TARGET}/${PORTVERSION}/include/float.h .endif ${MKDIR} ${STAGEDIR}${PREFIX}/share/toolchains/ ${INSTALL_DATA} ${WRKDIR}/xtoolchain.mk \ ${STAGEDIR}${PREFIX}/share/toolchains/${TARGETARCH}-gcc${SUFFIX}.mk .include 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 @@ -1,107 +1,81 @@ --- gcc/c-family/c-format.cc.orig 2022-05-06 00:30:56.000000000 -0700 +++ gcc/c-family/c-format.cc 2022-11-18 11:27:29.832693000 -0800 @@ -496,6 +496,17 @@ static const format_length_info printf_length_specs[] { NO_FMT, NO_FMT, 0 } }; +static const format_length_info freebsd_kprintf_length_specs[] = +{ + { "h", FMT_LEN_h, STD_C89, "hh", FMT_LEN_hh, STD_C99, 0 }, + { "l", FMT_LEN_l, STD_C89, "ll", FMT_LEN_ll, STD_C9L, 0 }, + { "q", FMT_LEN_ll, STD_EXT, NO_FMT, 0 }, + { "z", FMT_LEN_z, STD_C99, NO_FMT, 0 }, + { "t", FMT_LEN_t, STD_C99, NO_FMT, 0 }, + { "j", FMT_LEN_j, STD_C99, NO_FMT, 0 }, + { NO_FMT, NO_FMT, 0 } +}; + /* Length specifiers valid for asm_fprintf. */ static const format_length_info asm_fprintf_length_specs[] = { @@ -721,6 +732,41 @@ static const format_char_info print_char_table[] = { NULL, 0, STD_C89, NOLENGTHS, NULL, NULL, NULL } }; +static const format_char_info freebsd_ext_char_info = +{ NULL, 1, STD_EXT, { T89_C, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "", "cR", NULL }; + +static const format_char_info freebsd_kprintf_char_table[] = +{ + /* C89 conversion specifiers. */ + { "di", 0, STD_C89, { T89_I, T99_SC, T89_S, T89_L, T9L_LL, TEX_LL, T99_SST, T99_PD, T99_IM, BADLEN, BADLEN, BADLEN }, "-wp0 +'I", "i", NULL }, + { "oxX", 0, STD_C89, { T89_UI, T99_UC, T89_US, T89_UL, T9L_ULL, TEX_ULL, T99_ST, T99_UPD, T99_UIM, BADLEN, BADLEN, BADLEN }, "-wp0#", "i", NULL }, + { "u", 0, STD_C89, { T89_UI, T99_UC, T89_US, T89_UL, T9L_ULL, TEX_ULL, T99_ST, T99_UPD, T99_UIM, BADLEN, BADLEN, BADLEN }, "-wp0'I", "i", NULL }, + { "fgG", 0, STD_C89, { T89_D, BADLEN, BADLEN, T99_D, BADLEN, T89_LD, BADLEN, BADLEN, BADLEN, T2X_D32, T2X_D64, T2X_D128 }, "-wp0 +#'I", "", NULL }, + { "eE", 0, STD_C89, { T89_D, BADLEN, BADLEN, T99_D, BADLEN, T89_LD, BADLEN, BADLEN, BADLEN, T2X_D32, T2X_D64, T2X_D128 }, "-wp0 +#I", "", NULL }, + { "c", 0, STD_C89, { T89_I, BADLEN, BADLEN, T94_WI, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-w", "", NULL }, + { "s", 1, STD_C89, { T89_C, BADLEN, BADLEN, T94_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp", "cR", NULL }, + { "p", 1, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-w", "c", NULL }, + { "n", 1, STD_C89, { T89_I, T99_SC, T89_S, T89_L, T9L_LL, BADLEN, T99_SST, T99_PD, T99_IM, BADLEN, BADLEN, BADLEN }, "", "W", NULL }, + /* C99 conversion specifiers. */ + { "F", 0, STD_C99, { T99_D, BADLEN, BADLEN, T99_D, BADLEN, T99_LD, BADLEN, BADLEN, BADLEN, T2X_D32, T2X_D64, T2X_D128 }, "-wp0 +#'I", "", NULL }, + { "aA", 0, STD_C99, { T99_D, BADLEN, BADLEN, T99_D, BADLEN, T99_LD, BADLEN, BADLEN, BADLEN, T2X_D32, T2X_D64, T2X_D128 }, "-wp0 +#", "", NULL }, + /* X/Open conversion specifiers. */ + { "C", 0, STD_EXT, { TEX_WI, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-w", "", NULL }, + { "S", 1, STD_EXT, { TEX_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp", "R", NULL }, + /* FreeBSD kernel extensions (src/sys/kern/subr_prf.c). + The format %b is supported to decode error registers. + Its usage is: printf("reg=%b\n", regval, "*"); + which produces: reg=3 + The format %D provides a hexdump given a pointer and separator string: + ("%6D", ptr, ":") -> XX:XX:XX:XX:XX:XX + ("%*D", len, ptr, " ") -> XX XX XX XX ... + */ + { "D", 1, STD_EXT, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp", "cR", &freebsd_ext_char_info }, + { "b", 0, STD_EXT, { T89_I, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp", "", &freebsd_ext_char_info }, + { "ry", 0, STD_EXT, { T89_I, BADLEN, BADLEN, T89_L, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp0 +#", "i", NULL }, + { NULL, 0, STD_C89, NOLENGTHS, NULL, NULL, NULL } +}; + static const format_char_info asm_fprintf_char_table[] = { /* C89 conversion specifiers. */ @@ -991,6 +1037,18 @@ static const format_kind_info format_types_orig[] = strfmon_flag_specs, strfmon_flag_pairs, FMT_FLAG_ARG_CONVERT, 'w', '#', 'p', 0, 'L', 0, NULL, NULL + }, + { "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 + }, + { "freebsd_kprintf", freebsd_kprintf_length_specs, freebsd_kprintf_char_table, " +#0-'", NULL, + printf_flag_specs, printf_flag_pairs, + 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 } }; -@@ -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