exercism / exercism/c

C passes locally, not online (Compliation Flags)

Aperta
#699 13 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
C
Stelle
383
Fork
215
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

I been working C grade_school and got the tests passing locally, but on submission I found that they had failed (what!!??) as follows:
```bash
./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*.

```bash
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.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.