Skip to content
This repository has been archived by the owner on Jun 10, 2022. It is now read-only.
This repository has been archived by the owner on Jun 10, 2022. It is now read-only.

Defining NYOCI_SINGLETON breaks build #14

Open
@snej

Description

NYOCI_SINGLETON doesn't seem to be working; if I define it I get a compile error. There are also a large number (about 50?) of warnings, which harsh my mellow because I'm a zealot about -Werror.

In GCC when building for ESP32 I get one error and a warning:

libnyoci/nyoci-transaction.c: In function 'nyoci_internal_delete_transaction_':
libnyoci/nyoci-transaction.c:122:6: error: the address of 'gNyociInstance' will always evaluate as 'true' [-Werror=address]
  if (!nyoci_get_current_instance()) {
      ^
libnyoci/nyoci-transaction.c: In function 'nyoci_transaction_new_msg_id':
libnyoci/nyoci-transaction.c:198:12: error: 'self' undeclared (first use in this function)
   (void**)&self->transactions,
            ^

In Clang (Xcode) building for macOS, I get the above, and also many warnings of the form:

In file included from libnyoci/nyoci.c:43:
In file included from libnyoci/libnyoci.h:166:
In file included from plat-net/posix/nyoci-plat-net.h:82:
libnyoci/nyoci-plat-net-func.h:128:33: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes]
NYOCI_API_EXTERN nyoci_status_t nyoci_plat_process(nyoci_t self);
                                ^
libnyoci/nyoci-plat-net-func.h:44:53: note: expanded from macro 'nyoci_plat_process'
#define nyoci_plat_process(self)                nyoci_plat_process()

and a lesser number of corresponding no-prototype warnings like this:

libnyoci/nyoci.c:128:1: error: no previous prototype for function 'nyoci_init' [-Werror,-Wmissing-prototypes]
nyoci_init(nyoci_t self) {
^
In file included from libnyoci/nyoci.c:43:
libnyoci/libnyoci.h:132:27: note: expanded from macro 'nyoci_init'
#define nyoci_init(self)                nyoci_init()

The source of the problem is that a C prototype of a zero-arg function has to have (void), not just (). Silencing or ignoring these warnings would be dangerous because without prototypes there will be no parameter checking of calls to the affected functions!

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions