Currently, array vars_to_read is defined in file scope, so it has static storage duration, and its elements must have initializers that are constant expressions. However, the initializers for members 'name_len' and 'value_len' contain a function call (to strlen()), and are therefore not constant expressions: https://gitweb.gentoo.org/proj/portage-utils.git/tree/main.c?id=a0780928edc76543e63709c915fb7d581bd13291 While GCC happens to compile the package when it uses its builtin strlen(), it does correctly diagnose all instances of _Q_EVS and _Q_EVB use when building with option -fno-builtin-strlen ("error: initializer element is not constant"). Since all uses of strlen() have character string literals as arguments, I suggest making the code conforming by replacing strlen(x) with sizeof(x) - 1, which yields the correct result in this case, but is also a constant expression. https://forums.gentoo.org/viewtopic-t-1113224.html
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=b71b21d13405857d95cff02551558fed0c4d356e commit b71b21d13405857d95cff02551558fed0c4d356e Author: Fabian Groffen <grobian@gentoo.org> AuthorDate: 2020-05-16 18:50:19 +0000 Commit: Fabian Groffen <grobian@gentoo.org> CommitDate: 2020-05-16 18:50:19 +0000 main: use sizeof iso strlen to enforce compile-time constants Bug: https://bugs.gentoo.org/723422 Signed-off-by: Fabian Groffen <grobian@gentoo.org> main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
(In reply to Larry the Git Cow from comment #1) > commit b71b21d13405857d95cff02551558fed0c4d356e > Author: Fabian Groffen <grobian@gentoo.org> Thanks, Fabian, but Q_EV() still has a non-constant initializer for member 'name:len': .name_len = strlen(#V), \
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=2f5a42a9d667ac3625be33ae90faf650d4f51912 commit 2f5a42a9d667ac3625be33ae90faf650d4f51912 Author: Fabian Groffen <grobian@gentoo.org> AuthorDate: 2020-05-17 08:14:00 +0000 Commit: Fabian Groffen <grobian@gentoo.org> CommitDate: 2020-05-17 08:14:00 +0000 main: replace another instance of strlen with sizoef() - 1 As pointed out by Guillermo D. H. there was another instance of strlen used on a constant. Bug: https://bugs.gentoo.org/723422 Signed-off-by: Fabian Groffen <grobian@gentoo.org> main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
(In reply to Larry the Git Cow from comment #3) > commit 2f5a42a9d667ac3625be33ae90faf650d4f51912 > Author: Fabian Groffen <grobian@gentoo.org> app-portage/portage-utils-9999 builds for me now even if -fno-builtin-strlen is set in CFLAGS. Thank you.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=aa66d89f08797cc9d4f48e670fc277a57d1873bf commit aa66d89f08797cc9d4f48e670fc277a57d1873bf Author: Fabian Groffen <grobian@gentoo.org> AuthorDate: 2020-08-17 15:05:29 +0000 Commit: Fabian Groffen <grobian@gentoo.org> CommitDate: 2020-08-17 15:05:29 +0000 app-portage/portage-utils-0.89: version bump Closes: https://bugs.gentoo.org/711896 Closes: https://bugs.gentoo.org/698462 Closes: https://bugs.gentoo.org/723422 Package-Manager: Portage-2.3.103, Repoman-2.3.23 Signed-off-by: Fabian Groffen <grobian@gentoo.org> app-portage/portage-utils/Manifest | 2 +- ...age-utils-0.80.ebuild => portage-utils-0.89.ebuild} | 18 +----------------- 2 files changed, 2 insertions(+), 18 deletions(-)