Fix build failure in generate-accessors with -Werror set.#3079
Fix build failure in generate-accessors with -Werror set.#3079jimmunn wants to merge 1 commit intolinux-nvme:masterfrom
Conversation
The generate-accessors native executable uses asprintf() which requires _GNU_SOURCE. While the main project defines this flag via add_project_arguments(), native executables don't inherit these settings and need it explicitly defined. This fix adds -D_GNU_SOURCE to the c_args for the generate_accessors executable, resolving the implicit declaration warning that becomes a build error when -Werror is enabled.
|
Hi @jimmunn - Just curious. You mention that native executables don't inherit settings set by Ref: https://mesonbuild.com/Reference-manual_functions.html#add_global_arguments |
|
@martin-belanger , the reason the existing add_project_arguments does not apply to generate_accessors is because the add_project_arguments in the root meson.build file is does not set while generate_accessors sets This is the only place in the project that uses The documentation for add_global_arguments discourages its use, as you mentioned. We could add another add_project_arguments call in the root meson.build with native: true instead of what I did. However, that separates the macro declaration from the one place that it is used. I think it is probably cleaner to keep it as I originally implemented it. What do you think? |
|
Agreed! I forgot about that |
The generate-accessors native executable uses asprintf() which requires _GNU_SOURCE. While the main project defines this flag via add_project_arguments(), native executables don't inherit these settings and need it explicitly defined.
This fix adds -D_GNU_SOURCE to the c_args for the generate_accessors executable, resolving the implicit declaration warning that becomes a build error when -Werror is enabled.