Consider unifying inline macros
- Lenguaje dominante
- C
- Estrellas
- 27.9k
- Forks
- 2.6k
- Merge medio
- 1 d 3 h
- PR fusionados (30 d)
- 8
Descripción
There are three inline macros, `HINT_INLINE`, `MEM_STATIC`, `FORCE_INLINE_TEMPLATE`.
It would be nice they can be unified, such as:
* `HINT_INLINE`, only add `inline` keyword.
* `FORCE_INLINE`, force inline.
* `EXPAND_INLINE`, when `ZSTD_LIB_MINIFY` macro **is not** defined, it forces inline function; when `ZSTD_LIB_MINIFY` macro **is** defined, it's empty (no inline).
BTW, `HINT_INLINE` is force inline currently, the name is a bit confusing.
```c
/**
* HINT_INLINE is used to help the compiler generate better code. It is *not*
* used for "templates", so it can be tweaked based on the compilers
* performance.
*
* gcc-4.8 and gcc-4.9 have been shown to benefit from leaving off the
* always_inline attribute.
*
* clang up to 5.0.0 (trunk) benefit tremendously from the always_inline
* attribute.
*/
#if !defined(__clang__) && defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 8 && __GNUC__ < 5
# define HINT_INLINE static INLINE_KEYWORD
#else
# define HINT_INLINE static INLINE_KEYWORD FORCE_INLINE_ATTR
#endif
```
These functions are using `HINT_INLINE`:
\lib\compress\zstd_compress_internal.h:
`ZSTD_storeSeq()`
\lib\decompress\huf_decompress.c:
`HUF_decodeStreamX1()`
`HUF_decodeStreamX2()`
\lib\decompress\zstd_decompress_block.c:
`ZSTD_overlapCopy8()`
`ZSTD_execSequence()`
Guía de contribución
Evaluación
Este issue todavía no se ha evaluado.