-
Notifications
You must be signed in to change notification settings - Fork 321
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
Fixed most compiler warnings -Wall -Wextra #78
Conversation
repro: CFLAGS="-Wall -Wextra -Wunused-parameter -Wc++-compat" ./configure && make which we use for perl, and libyaml is now included in cperl. Tested with gcc-5 and clang-3.7 There are still a tons of format warnings (%d on 64bit) in example-deconstructor.c which I skipped.
* but serve no purpose inside. Silence compiler warnings. */ | ||
#define SHIM(a) /*@unused@*/ a __attribute__unused__ | ||
|
||
/* UNUSED_PARAM() marks a shim argument in the body to silence compiler warnings */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UNUSED_PARAM
-> YAML_UNUSED
?
|
||
/* Shim arguments are arguments that must be included in your function, | ||
* but serve no purpose inside. Silence compiler warnings. */ | ||
#define SHIM(a) /*@unused@*/ a __attribute__unused__ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SHIM
-> YAML_UNUSED_ATTRIBUTE
(or similar name) ?
/* Strict C compiler warning helpers */ | ||
|
||
#if defined(__clang__) || defined(__GNUC__) | ||
# define HASATTRIBUTE_UNUSED |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HASATTRIBUTE_UNUSED
-> YAML_HASATTRIBUTE_UNUSED
# define HASATTRIBUTE_UNUSED | ||
#endif | ||
#ifdef HASATTRIBUTE_UNUSED | ||
# define __attribute__unused__ __attribute__((__unused__)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
__attribute__unused__
-> YAML_ATTRIBUTE_UNUSED
?
Beside of few nitpicks, looks good. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jcfr I appreciate the review. Please keep in mind, your comments are for yaml_private.h
header so I don't think we need to worry about naming for export. Cheers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it. Thanks for doing this @perlpunk.
I took @rurban's Pull Request #27 and rebased it to master.
Then I cherry-picked this commit. Maybe this makes it easier
to review.