Skip to content

Clang compile issue #15

@Maturin

Description

@Maturin

When including the utf.h directly or indirectly in my code, I get this error message - at least when compiling the code with Clang 20.

.../MicrosoftCompoundFileReader/include/compoundfilereader/utf.h:52:12: error: 'static' function 'CodePointToUTF8' declared in header file should be declared 'static inline' [-Werror,-Wunneeded-internal-declaration]
   52 | static int CodePointToUTF8(uint32_t cp, uint32_t* c1, uint32_t* c2, uint32_t* c3, uint32_t* c4)
      |            ^~~~~~~~~~~~~~~
1 error generated.

The function is comparably small, so changing static to static inline as suggested by clang, would be an option.

But I am wondering, if declaring the function simple as inline would be sufficient. Then the compiler/linker can decide if it is inlined or a single instance of the function is linked. (Contrary to static inline, which would result in one function for each compilation unit, which includes the function.)

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