Skip to content

Conflicting Types for Functions #280

@rowanfr

Description

@rowanfr

When using -Werror for compiling this (as part of GUIX for RISC-V for context) the error:

esl-iter.c:84:1: error: conflicting types for ‘esl_iter_next_with_size_correction’ due to enum/integer mismatch; have ‘esl_iter_status_t(esl_iter *, efi_guid_t *, efi_guid_t *, uint8_t **, size_t *, _Bool)’ {aka ‘enum esl_iter_status(esl_iter *, efi_guid_t *, efi_guid_t *, unsigned char **, long unsigned int *, _Bool)’} [-Werror=enum-int-mismatch]
...
esl-iter.h:61:12: note: previous declaration of ‘esl_iter_next_with_size_correction’ with type ‘int(esl_iter *, efi_guid_t *, efi_guid_t *, uint8_t **, size_t *, _Bool)’ {aka ‘int(esl_iter *, efi_guid_t *, efi_guid_t *, unsigned char **, long unsigned int *, _Bool)’}

is produced. This is due to C assuming int when no return type is specified. Granted it is an int type in the form of an enum which is why -Werror produces an error but there is no genuine issue in functionality or typing. We can just declare the return type to be the esl_iter_status_t enum explicitly in the source file and resolve this error alongside any other functions that will produce this error.

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