-
-
Notifications
You must be signed in to change notification settings - Fork 200
Open
Description
I been working C grade_school and got the tests passing locally, but on submission I found that they had failed (what!!??) as follows:
./grade_school.c:10:6: error: no previous declaration for 'existing_student' [-Werror=missing-declarations]
bool existing_student(char name[]) {
^~~~~~~~~~~~~~~~
./grade_school.c:21:5: error: no previous declaration for 'compare_students' [-Werror=missing-declarations]
int compare_students(const void *a, const void *b) {
^~~~~~~~~~~~~~~~
./grade_school.c:28:11: error: no previous declaration for 'create_student' [-Werror=missing-declarations]
student_t create_student(uint8_t grade, char name[]) {
^~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make: *** [makefile:37: tests.out] Error 1
Apparently, I need to include declarations for private functions (why?). What I don't understand why this issue isn't raised when I test locally? As far as I can see the make file includes flags for missing-declarations.
CFLAGS = -std=c99
CFLAGS += -g
CFLAGS += -Wall
CFLAGS += -Wextra
CFLAGS += -pedantic
CFLAGS += -Werror
CFLAGS += -Wmissing-declarations
CFLAGS += -DUNITY_SUPPORT_64
-- Added --
After further investigation I learned that that clang has a -Weverything compilation flag. Running with this set I can see numerous issues with my solution. It would seem that Clang is treating the [-Werror=missing-declarations] errors reported above as a [-Wmissing-prototypes] errors.
Metadata
Metadata
Assignees
Labels
No labels