Skip to content

Commit

Permalink
Fix some warnings seen on Travis
Browse files Browse the repository at this point in the history
  • Loading branch information
tbodt committed May 31, 2020
1 parent c07142f commit e846501
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
7 changes: 3 additions & 4 deletions fs/sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -1161,12 +1161,11 @@ const struct fd_ops socket_fdops = {
.ioctl = realfs_ioctl,
};

#if defined(__GNUC__)
#if defined(__clang__)
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#else
#if defined(__GNUC__) && __GNUC__ >= 8
#pragma GCC diagnostic ignored "-Wcast-function-type"
#endif
#if defined(__clang__)
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#endif
static struct socket_call {
syscall_t func;
Expand Down
2 changes: 1 addition & 1 deletion kernel/calls.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dword_t syscall_success_stub() {
return 0;
}

#if defined(__GNUC__) && !defined(__clang__)
#if is_gcc(8)
#pragma GCC diagnostic ignored "-Wcast-function-type"
#endif
syscall_t syscall_table[] = {
Expand Down
2 changes: 1 addition & 1 deletion kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "kernel/vdso.h"
#include "emu/interrupt.h"

#if defined(__GNUC__) && !defined(__clang__)
#if is_gcc(9)
#pragma GCC diagnostic ignored "-Waddress-of-packed-member"
#endif

Expand Down
6 changes: 6 additions & 0 deletions misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
#define str(x) _str(x)
#define _str(x) #x

// compiler checks
#define is_clang(version) (__clang__ && __clang_major__ >= version)
#define is_gcc(version) (__GNUC__ >= version)

// keywords
#define bits unsigned int
#define forceinline inline __attribute__((always_inline))
Expand All @@ -30,7 +34,9 @@
#define unlikely(x) __builtin_expect((x), 0)
#define typecheck(type, x) ({type _x = x; x;})
#define must_check __attribute__((warn_unused_result))
#if is_gcc(7) || is_clang(10)
#define fallthrough __attribute__((fallthrough))
#endif

#if defined(__has_attribute) && __has_attribute(no_sanitize)
#define __no_instrument_msan
Expand Down

0 comments on commit e846501

Please sign in to comment.