Skip to content

Conversation

@alex-moch
Copy link

@alex-moch alex-moch commented Jan 1, 2026

Align the declarations of BIT_readBits() and BIT_reloadDStream() in bitstream.h with their FORCE_INLINE_TEMPLATE definitions.

The previous MEM_STATIC declarations caused an attribute mismatch between the header and the definitions, which can lead to incorrect compiler assumptions under certain toolchains and optimization levels.


  CC [M]  zstd/lib/common/entropy_common.o
In file included from /data/zstd/lib/common/fse.h:230,
                 from /data/zstd/lib/common/entropy_common.c:22:
/data/zstd/lib/common/bitstream.h:363:40: error: 'gnu_inline' attribute present on 'BIT_readBits'
  363 | FORCE_INLINE_TEMPLATE BitContainerType BIT_readBits(BIT_DStream_t* bitD, unsigned nbBits)
      |                                        ^~~~~~~~~~~~
/data/zstd/lib/common/bitstream.h:106:29: error: but not here
  106 | MEM_STATIC BitContainerType BIT_readBits(BIT_DStream_t* bitD, unsigned nbBits);
      |                             ^~~~~~~~~~~~
/data/zstd/lib/common/bitstream.h:413:42: error: 'gnu_inline' attribute present on 'BIT_reloadDStream'
  413 | FORCE_INLINE_TEMPLATE BIT_DStream_status BIT_reloadDStream(BIT_DStream_t* bitD)
      |                                          ^~~~~~~~~~~~~~~~~
/data/zstd/lib/common/bitstream.h:107:31: error: but not here
  107 | MEM_STATIC BIT_DStream_status BIT_reloadDStream(BIT_DStream_t* bitD);
      |                               ^~~~~~~~~~~~~~~~~

Align the declarations of BIT_readBits() and BIT_reloadDStream() in
bitstream.h with their FORCE_INLINE_TEMPLATE definitions.

The previous MEM_STATIC declarations caused an attribute mismatch
between the header and the definitions, which can lead to incorrect
compiler assumptions under certain toolchains and optimization levels.

Signed-off-by: Alexander Moch <mail@alexmoch.com>
@meta-cla meta-cla bot added the CLA Signed label Jan 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant