Skip to content

grasshopper_l and grasshopper_l_inv declared 'static' but never defined #488

@IWillBurn

Description

@IWillBurn

Добрый день!

При попытке импорта
#include <gost-engine/gost_grasshopper_core.h>

В билде моего проекта ловлю классический Werror:

0.827 /usr/include/gost-engine/gost_grasshopper_core.h:15:20: error: 'grasshopper_l' declared 'static' but never defined [-Werror=unused-function]
0.827    15 | static inline void grasshopper_l(grasshopper_w128_t* w);
0.827       |                    ^~~~~~~~~~~~~
0.827 /usr/include/gost-engine/gost_grasshopper_core.h:16:20: error: 'grasshopper_l_inv' declared 'static' but never defined [-Werror=unused-function]
0.827    16 | static inline void grasshopper_l_inv(grasshopper_w128_t* w);
0.827       |                    ^~~~~~~~~~~~~~~~~
0.827 In file included from ./tpm2/crypto/openssl/TpmToGostSupport_fp.h:5,
0.827                  from ./tpm2/crypto/openssl/TpmToOsslSym.h:201,
0.827                  from ./tpm2/crypto/openssl/LibSupport.h:78,
0.827                  from tpm2/Tpm.h:69,
0.827                  from tpm_tpm2_interface.c:47:
0.827 /usr/include/gost-engine/gost_grasshopper_core.h:15:20: error: 'grasshopper_l' declared 'static' but never defined [-Werror=unused-function]
0.827    15 | static inline void grasshopper_l(grasshopper_w128_t* w);
0.827       |                    ^~~~~~~~~~~~~
0.827 /usr/include/gost-engine/gost_grasshopper_core.h:16:20: error: 'grasshopper_l_inv' declared 'static' but never defined [-Werror=unused-function]
0.827    16 | static inline void grasshopper_l_inv(grasshopper_w128_t* w);

Кажется, разделение static функций на declaration в .h gost_grasshopper_core.h и definition в .c gost_grasshopper_core.c — плохая практика. Думаю, стоит определить static функции непосредственно в .h файле, как это сделано, например, в gost_grasshopper_math.h. На моей сборке такая смена места определения с .c на .h помогает решить проблему.

Я не очень силён в C, подскажите, насколько это релевантно. Я опираюсь на этот тред stackoverflow.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions