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

Fixed most compiler warnings -Wall -Wextra #78

Merged
merged 1 commit into from
Jan 8, 2018

Conversation

perlpunk
Copy link
Member

@perlpunk perlpunk commented Dec 3, 2017

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.

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 */
Copy link
Contributor

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__
Copy link
Contributor

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
Copy link
Contributor

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__))
Copy link
Contributor

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 ?

@jcfr
Copy link
Contributor

jcfr commented Dec 6, 2017

Beside of few nitpicks, looks good.

Copy link
Contributor

@sigmavirus24 sigmavirus24 left a 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

Copy link
Member

@ingydotnet ingydotnet left a 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.

@ingydotnet ingydotnet mentioned this pull request Jan 8, 2018
@ingydotnet ingydotnet merged commit fc2dd94 into master Jan 8, 2018
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.

4 participants