Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

include/queue.h: ensure prototypes match implementations #70

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

orlitzky
Copy link
Contributor

In the latest C23 standard, the prototype

int get_queue_id();

indicates that get_queue_id takes no arguments. This of course disagrees with its implementation, which takes one argument. C23 will be the default mode in GCC-15, where this leads to a build failure:

queue.c:57:5: error: conflicting types for 'get_queue_id'; have 'int(int)'
 57 | int get_queue_id(int id) {
    |     ^~~~~~~~~~~~
In file included from queue.c:30:
../include/queue.h:40:5: note: previous declaration of 'get_queue_id' with
type 'int(void)'
 40 | int get_queue_id();
    |     ^~~~~~~~~~~~

To fix it, we update the prototype for get_queue_id().

In the latest C23 standard, the prototype

  int get_queue_id();

indicates that get_queue_id takes no arguments. This of course
disagrees with its implementation, which takes one argument. C23 will
be the default mode in GCC-15, where this leads to a build failure:

  queue.c:57:5: error: conflicting types for 'get_queue_id'; have 'int(int)'
   57 | int get_queue_id(int id) {
      |     ^~~~~~~~~~~~
  In file included from queue.c:30:
  ../include/queue.h:40:5: note: previous declaration of 'get_queue_id' with
  type 'int(void)'
   40 | int get_queue_id();
      |     ^~~~~~~~~~~~

To fix it, we update the prototype for get_queue_id().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant