diff --git a/foma-c99.patch b/foma-c99.patch new file mode 100644 index 0000000..904700c --- /dev/null +++ b/foma-c99.patch @@ -0,0 +1,33 @@ +Fix BOM_codes initializer + +Future compilers will reject the current initializer: + +io.c:1002:7: error: initialization of ‘char’ from ‘void *’ makes integer from pointer without a cast + 1002 | { NULL, 0, NULL }, + | ^~~~ +io.c:1002:16: error: initialization of ‘char’ from ‘void *’ makes integer from pointer without a cast + 1002 | { NULL, 0, NULL }, + | ^~~~ +io.c:996:26: warning: missing braces around initializer [-Wmissing-braces] + 996 | static BOM BOM_codes[] = { + | ^ +io.c:996:26: warning: missing braces around initializer [-Wmissing-braces] + +The reason is that NULL is usually a pointer constant, which is not a +valid expression for a character. + +Submitted upstream: + +diff --git a/foma/io.c b/foma/io.c +index 5f6644419080df49..8fcaecb9c113758a 100644 +--- a/foma/io.c ++++ b/foma/io.c +@@ -999,7 +999,7 @@ static BOM BOM_codes[] = { + { { 0x00, 0x00, 0xFE, 0xFF }, 4, "UTF-32BE" }, + { { 0xFF, 0xFE }, 2, "UTF16-LE" }, + { { 0xFE, 0xFF }, 2, "UTF16-BE" }, +- { NULL, 0, NULL }, ++ { { 0, } , 0, NULL }, + }; + + BOM *check_BOM(char *buffer) { diff --git a/foma.spec b/foma.spec index ba06313..fb25469 100644 --- a/foma.spec +++ b/foma.spec @@ -9,7 +9,7 @@ Name: foma Version: 0.10.0 -Release: 0.7.%{snapshotdate}git%{shortcommit0}%{?dist} +Release: 0.8.%{snapshotdate}git%{shortcommit0}%{?dist} Summary: Xerox-compatible finite-state compiler License: Apache-2.0 @@ -26,6 +26,7 @@ Source0: https://github.com/mhulden/%{name}/archive/%{commit0}.tar.gz#/%{ # the linker when building the shared library. For discussion on a similar # issue, see https://lists.debian.org/debian-devel/2016/05/msg00302.html Patch0: foma-harden-build-fedora.patch +Patch1: foma-c99.patch BuildRequires: gcc zlib-devel readline-devel flex bison BuildRequires: make @@ -104,6 +105,9 @@ find %{buildroot} -name '*.a' -exec rm -f {} ';' %changelog +* Thu Jan 04 2024 Florian Weimer - 0.10.0-0.8.20210601gitdfe1ccb +- Fix C compatibility issue + * Mon Aug 21 2023 Parag Nemade - 0.10.0-0.7.20210601gitdfe1ccb - Migrate to SPDX license expression