Skip to content

Conversation

DimitryAndric
Copy link
Contributor

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.

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>
@DimitryAndric
Copy link
Contributor Author

@tsoome, @amotin

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>
@amotin amotin merged commit c480e06 into openzfs:master Oct 29, 2024
20 checks passed
@amotin amotin added the Status: Accepted Ready to integrate (reviewed, tested) label Oct 29, 2024
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
lundman pushed a commit to openzfsonwindows/openzfs that referenced this pull request Jan 26, 2025
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
bsdjhb pushed a commit to bsdjhb/cheribsd that referenced this pull request Sep 3, 2025
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Accepted Ready to integrate (reviewed, tested)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants