-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix gcc unused value warning in FreeBSD simd.h #16693
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The macros `simd_stat_init()` and `simd_stat_fini()` in FreeBSD's `simd.h` are defined as zero, but they are actually only used as statements. Replace the definitions with `do {} while (0)` instead, to avoid gcc `-Wunused-value` warnings. Signed-off-by: Dimitry Andric <dimitry@andric.com>
amotin
approved these changes
Oct 27, 2024
mcmilk
approved these changes
Oct 27, 2024
tsoome
approved these changes
Oct 27, 2024
behlendorf
approved these changes
Oct 27, 2024
freebsd-git
pushed a commit
to freebsd/freebsd-src
that referenced
this pull request
Oct 28, 2024
With gcc we are seeing the following -Werror warnings: /workspace/src/sys/contrib/openzfs/include/os/freebsd/spl/sys/simd.h:53:33: error: statement with no effect [-Werror=unused-value] 53 | #define simd_stat_init() 0 | ^ /workspace/src/sys/contrib/openzfs/module/zcommon/zfs_prop.c:1092:9: note: in expansion of macro 'simd_stat_init' 1092 | simd_stat_init(); | ^~~~~~~~~~~~~~ /workspace/src/sys/contrib/openzfs/module/zcommon/zfs_prop.c: In function 'zcommon_fini': /workspace/src/sys/contrib/openzfs/include/os/freebsd/spl/sys/simd.h:54:33: error: statement with no effect [-Werror=unused-value] 54 | #define simd_stat_fini() 0 | ^ /workspace/src/sys/contrib/openzfs/module/zcommon/zfs_prop.c:1100:9: note: in expansion of macro 'simd_stat_fini' 1100 | simd_stat_fini(); | ^~~~~~~~~~~~~~ Both `simd_stat_init()` and `simd_stat_fini()` are defined in the FreeBSD specific version of `simd.h`: #define simd_stat_init() 0 #define simd_stat_fini() 0 These should both be defined as `do {} while (0)` instead, similar to other macros in this file. Reviewed by: mav, tsoome (upstream) Obtained from: openzfs/zfs#16693 MFC after: 3 days Differential Revision: <https://reviews.freebsd.org/D47297>
behlendorf
pushed a commit
to behlendorf/zfs
that referenced
this pull request
Nov 1, 2024
The macros `simd_stat_init()` and `simd_stat_fini()` in FreeBSD's `simd.h` are defined as zero, but they are actually only used as statements. Replace the definitions with `do {} while (0)` instead, to avoid gcc `-Wunused-value` warnings. Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Toomas Soome <tsoome@me.com> Signed-off-by: Dimitry Andric <dimitry@andric.com> Closes openzfs#16693
ptr1337
pushed a commit
to CachyOS/zfs
that referenced
this pull request
Nov 14, 2024
The macros `simd_stat_init()` and `simd_stat_fini()` in FreeBSD's `simd.h` are defined as zero, but they are actually only used as statements. Replace the definitions with `do {} while (0)` instead, to avoid gcc `-Wunused-value` warnings. Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Toomas Soome <tsoome@me.com> Signed-off-by: Dimitry Andric <dimitry@andric.com> Closes openzfs#16693
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With gcc we are seeing the following -Werror warnings:
Both
simd_stat_init()
andsimd_stat_fini()
are defined in the FreeBSD specific version ofsimd.h
:These should both be defined as
do {} while (0)
instead, similar to other macros in this file.