Skip to content
Snippets Groups Projects
  • Miguel Ojeda's avatar
    ff98e20e
    lib/crc32.c: mark crc32_le_base/__crc32c_le_base aliases as __pure · ff98e20e
    Miguel Ojeda authored
    
    The upcoming GCC 9 release extends the -Wmissing-attributes warnings
    (enabled by -Wall) to C and aliases: it warns when particular function
    attributes are missing in the aliases but not in their target.
    
    In particular, it triggers here because crc32_le_base/__crc32c_le_base
    aren't __pure while their target crc32_le/__crc32c_le are.
    
    These aliases are used by architectures as a fallback in accelerated
    versions of CRC32. See commit 9784d82d ("lib/crc32: make core crc32()
    routines weak so they can be overridden").
    
    Therefore, being fallbacks, it is likely that even if the aliases
    were called from C, there wouldn't be any optimizations possible.
    Currently, the only user is arm64, which calls this from asm.
    
    Still, marking the aliases as __pure makes sense and is a good idea
    for documentation purposes and possible future optimizations,
    which also silences the warning.
    
    Acked-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
    Tested-by: default avatarLaura Abbott <labbott@redhat.com>
    Signed-off-by: default avatarMiguel Ojeda <miguel.ojeda.sandonis@gmail.com>
    ff98e20e
    History
    lib/crc32.c: mark crc32_le_base/__crc32c_le_base aliases as __pure
    Miguel Ojeda authored
    
    The upcoming GCC 9 release extends the -Wmissing-attributes warnings
    (enabled by -Wall) to C and aliases: it warns when particular function
    attributes are missing in the aliases but not in their target.
    
    In particular, it triggers here because crc32_le_base/__crc32c_le_base
    aren't __pure while their target crc32_le/__crc32c_le are.
    
    These aliases are used by architectures as a fallback in accelerated
    versions of CRC32. See commit 9784d82d ("lib/crc32: make core crc32()
    routines weak so they can be overridden").
    
    Therefore, being fallbacks, it is likely that even if the aliases
    were called from C, there wouldn't be any optimizations possible.
    Currently, the only user is arm64, which calls this from asm.
    
    Still, marking the aliases as __pure makes sense and is a good idea
    for documentation purposes and possible future optimizations,
    which also silences the warning.
    
    Acked-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
    Tested-by: default avatarLaura Abbott <labbott@redhat.com>
    Signed-off-by: default avatarMiguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
crc32.c 9.29 KiB