Skip to content

Commit

Permalink
Cleanup warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
nviennot committed Nov 7, 2019
1 parent 1600a81 commit ba860b8
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 19 deletions.
7 changes: 5 additions & 2 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ CFLAGS += -g
CFLAGS += -Wno-long-long -Wall -W -Wnested-externs -Wformat=2
CFLAGS += -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations
CFLAGS += -Wwrite-strings -Wshadow -Wpointer-arith -Wsign-compare
CFLAGS += -Wundef -Wbad-function-cast -Winline -Wcast-align
CFLAGS += -Wdeclaration-after-statement -Wno-pointer-sign -Wno-attributes
CFLAGS += -Wundef -Wbad-function-cast -Winline
CFLAGS += -Wno-pointer-sign -Wno-attributes
CPPFLAGS += -DDEBUG
endif
if IS_COVERAGE
Expand All @@ -44,6 +44,9 @@ endif
CPPFLAGS += -iquote.
endif

CFLAGS += -Wno-unused-parameter -Wno-unused-variable -Wno-null-pointer-arithmetic
CFLAGS += -Wno-deprecated-declarations -Wno-format-nonliteral

# Set flags for Solaris.
if IS_SUNOS
if IS_GCC
Expand Down
3 changes: 0 additions & 3 deletions client.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,6 @@ int run_headless_command(int argc, const char **argv, int flags, void (*err_call
return 0;

/* error messages land in cfg_causes */
extern char **cfg_causes;
extern u_int cfg_ncauses;

int ret = cfg_ncauses ? -1 : 0;
for (u_int i = 0; i < cfg_ncauses; i++) {
if (err_callback)
Expand Down
4 changes: 3 additions & 1 deletion compat/b64_ntop.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
#include <stdlib.h>
#include <string.h>

#include "compat.h"

#define Assert(Cond) if (!(Cond)) abort()

static const char Base64[] =
Expand Down Expand Up @@ -122,7 +124,7 @@ static const char Pad64 = '=';
*/

int
b64_ntop(uint8_t const *src, size_t srclength, char *target, size_t targsize) {
b64_ntop(const char *src, size_t srclength, char *target, size_t targsize) {
size_t datalength = 0;
uint8_t input[3];
uint8_t output[4];
Expand Down
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

AC_INIT(tmate, 2.3.1)

AM_SILENT_RULES([yes])
AC_CONFIG_AUX_DIR(etc)
AM_INIT_AUTOMAKE([foreign subdir-objects])

Expand Down
9 changes: 7 additions & 2 deletions log.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ log_close(void)
}

/* Write a log message. */
__attribute__((__format__(__printf__, 1, 0)))
static void
log_vwrite(const char *msg, va_list ap)
{
Expand Down Expand Up @@ -144,6 +145,7 @@ log_emit(int level, const char *msg, ...)
}

/* Log a critical error with error string and die. */
__attribute__((__format__(__printf__, 1, 0)))
__dead void
fatal(const char *msg, ...)
{
Expand All @@ -153,11 +155,13 @@ fatal(const char *msg, ...)
va_start(ap, msg);
if (asprintf(&fmt, "fatal: %s: %s", msg, strerror(errno)) == -1)
exit(1);
log_vwrite(fmt, ap);
msg = fmt;
log_vwrite(msg, ap);
exit(1);
}

/* Log a critical error and die. */
__attribute__((__format__(__printf__, 1, 0)))
__dead void
fatalx(const char *msg, ...)
{
Expand All @@ -167,6 +171,7 @@ fatalx(const char *msg, ...)
va_start(ap, msg);
if (asprintf(&fmt, "fatal: %s", msg) == -1)
exit(1);
log_vwrite(fmt, ap);
msg = fmt;
log_vwrite(msg, ap);
exit(1);
}
2 changes: 2 additions & 0 deletions osdep-darwin.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ char *osdep_get_name(int, char *);
char *osdep_get_cwd(int);
struct event_base *osdep_event_init(void);

#ifndef __unused
#define __unused __attribute__ ((__unused__))
#endif

char *
osdep_get_name(int fd, __unused char *tty)
Expand Down
2 changes: 1 addition & 1 deletion screen-redraw.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ screen_redraw_draw_borders(struct client *c, int status, u_int top)
struct window *w = s->curw->window;
struct options *oo = w->options;
struct tty *tty = &c->tty;
struct window_pane *wp;
struct window_pane *wp = NULL;
struct grid_cell m_active_gc, active_gc, m_other_gc, other_gc;
struct grid_cell msg_gc;
u_int i, j, type, msgx = 0, msgy = 0;
Expand Down
1 change: 1 addition & 0 deletions session.c
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,7 @@ session_group_index(struct session_group *sg)
}

fatalx("session group not found");
for(;;);
}

/*
Expand Down
2 changes: 1 addition & 1 deletion tmate-session.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ void tmate_session_init(struct event_base *base)
tmate_write_header();
}

static void send_authorized_keys()
static void send_authorized_keys(void)
{
char *path;
path = options_get_string(global_options, "tmate-authorized-keys");
Expand Down
18 changes: 9 additions & 9 deletions tmate-ssh-client.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ static int passphrase_callback(__unused const char *prompt, char *buf, size_t le
client->tmate_session->need_passphrase = 1;

if (client->tmate_session->passphrase)
strncpy(buf, client->tmate_session->passphrase, len);
strlcpy(buf, client->tmate_session->passphrase, len);
else
strcpy(buf, "");

Expand Down Expand Up @@ -268,7 +268,7 @@ static void on_ssh_client_event(struct tmate_ssh_client *client)
}

client->state = SSH_CONNECT;
/* fall through */
// fall through

case SSH_CONNECT:
switch (ssh_connect(session)) {
Expand All @@ -284,8 +284,8 @@ static void on_ssh_client_event(struct tmate_ssh_client *client)

tmate_debug("Establishing connection to %s", client->server_ip);
client->state = SSH_AUTH_SERVER;
/* fall through */
}
// fall through

case SSH_AUTH_SERVER:
#if LIBSSH_VERSION_INT >= SSH_VERSION_INT(0, 9, 0)
Expand Down Expand Up @@ -352,7 +352,7 @@ static void on_ssh_client_event(struct tmate_ssh_client *client)
on_ssh_auth_server_complete(client);

client->state = SSH_AUTH_CLIENT_NONE;
/* fall through */
// fall through

case SSH_AUTH_CLIENT_NONE:
switch (ssh_userauth_none(session, NULL)) {
Expand All @@ -368,8 +368,8 @@ static void on_ssh_client_event(struct tmate_ssh_client *client)
case SSH_AUTH_PARTIAL:
case SSH_AUTH_DENIED:
client->state = SSH_AUTH_CLIENT_PUBKEY;
/* fall through */
}
// fall through

case SSH_AUTH_CLIENT_PUBKEY:
client->tried_passphrase = client->tmate_session->passphrase;
Expand Down Expand Up @@ -397,8 +397,8 @@ static void on_ssh_client_event(struct tmate_ssh_client *client)
case SSH_AUTH_SUCCESS:
tmate_debug("Auth successful with pubkey");
client->state = SSH_NEW_CHANNEL;
/* fall through */
}
// fall through

SSH_NEW_CHANNEL:
case SSH_NEW_CHANNEL:
Expand All @@ -408,6 +408,7 @@ static void on_ssh_client_event(struct tmate_ssh_client *client)
return;
}
client->state = SSH_OPEN_CHANNEL;
// fall through

case SSH_OPEN_CHANNEL:
switch (ssh_channel_open_session(channel)) {
Expand All @@ -420,8 +421,8 @@ static void on_ssh_client_event(struct tmate_ssh_client *client)
case SSH_OK:
tmate_debug("Session opened, initalizing tmate");
client->state = SSH_BOOTSTRAP;
/* fall through */
}
// fall through

case SSH_BOOTSTRAP:
switch (ssh_channel_request_subsystem(channel, "tmate")) {
Expand Down Expand Up @@ -449,9 +450,8 @@ static void on_ssh_client_event(struct tmate_ssh_client *client)

free(client->tmate_session->last_server_ip);
client->tmate_session->last_server_ip = xstrdup(client->server_ip);

/* fall through */
}
// fall through

case SSH_READY:
read_channel(client);
Expand Down
2 changes: 2 additions & 0 deletions tmux.h
Original file line number Diff line number Diff line change
Expand Up @@ -1576,6 +1576,8 @@ void proc_kill_peer(struct tmuxpeer *);
extern int cfg_finished;
extern int cfg_references;
extern struct client *cfg_client;
extern char **cfg_causes;
extern u_int cfg_ncauses;
void start_cfg(void);
int load_cfg(const char *, struct cmd_q *, char **);
void set_cfg_file(const char *);
Expand Down
2 changes: 2 additions & 0 deletions xmalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ xasprintf(char **ret, const char *fmt, ...)
return i;
}

__attribute__((__format__(__printf__, 2, 0)))
int
xvasprintf(char **ret, const char *fmt, va_list ap)
{
Expand All @@ -120,6 +121,7 @@ xsnprintf(char *str, size_t len, const char *fmt, ...)
return i;
}

__attribute__((__format__(__printf__, 3, 0)))
int
xvsnprintf(char *str, size_t len, const char *fmt, va_list ap)
{
Expand Down

0 comments on commit ba860b8

Please sign in to comment.