Some of the argument values are not in use, and few functions does not
return. Informing which will make few warning messages disapper, and
compiler to generate better binary.
Signed-off-by: Sami Kerola <kerolasa(a)iki.fi>
---
Makefile.am | 14 +++++++++++---
cronie_common.h | 37 +++++++++++++++++++++++++++++++++++++
src/cron.c | 3 ++-
src/crontab.c | 4 +++-
src/security.c | 8 ++++++--
5 files changed, 59 insertions(+), 7 deletions(-)
create mode 100644 cronie_common.h
diff --git a/Makefile.am b/Makefile.am
index abbce4a..58ecaac 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -8,6 +8,14 @@ pamdir = $(sysconfdir)/pam.d
dist_pam_DATA = pam/crond
endif
-EXTRA_DIST = cronie.init crond.sysconfig contrib/anacrontab \
- contrib/0anacron contrib/0hourly \
- contrib/dailyjobs contrib/cronie.systemd
+dist_noinst_HEADERS = \
+ cronie_common.h
+
+EXTRA_DIST = \
+ cronie.init \
+ crond.sysconfig \
+ contrib/anacrontab \
+ contrib/0anacron \
+ contrib/0hourly \
+ contrib/dailyjobs \
+ contrib/cronie.systemd
diff --git a/cronie_common.h b/cronie_common.h
new file mode 100644
index 0000000..4ce172e
--- /dev/null
+++ b/cronie_common.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2012 Copyright Red Hat Software
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* Collection of definitions, inline functions, etc, that are useful for
+ * both cron and anacron. */
+
+#ifndef CRONIE_COMMON_H
+#define CRONIE_COMMON_H
+
+#ifndef __attribute__
+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8)
+# define __attribute__(x) /* empty */
+# endif
+#endif
+
+#ifndef ATTRIBUTE_NORETURN
+# define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
+#endif
+
+#ifndef ATTRIBUTE_UNUSED
+# define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
+#endif
+
+#endif /* CRONIE_COMMON_H */
diff --git a/src/cron.c b/src/cron.c
index 879139e..5ecd08d 100644
--- a/src/cron.c
+++ b/src/cron.c
@@ -48,6 +48,7 @@
# include <sys/fcntl.h>
#endif
+#include "cronie_common.h"
#include "funcs.h"
#include "globals.h"
#include "pathnames.h"
@@ -60,7 +61,7 @@ int inotify_enabled;
enum timejump { negative, small, medium, large };
-static void usage(void),
+static void usage(void) ATTRIBUTE_NORETURN,
run_reboot_jobs(cron_db *),
find_jobs(int, cron_db *, int, int, long),
set_time(int),
diff --git a/src/crontab.c b/src/crontab.c
index 5592939..7202a65 100644
--- a/src/crontab.c
+++ b/src/crontab.c
@@ -56,6 +56,7 @@
# include <selinux/av_permissions.h>
#endif
+#include "cronie_common.h"
#include "bitstring.h"
#include "externs.h"
#include "funcs.h"
@@ -101,11 +102,12 @@ static void list_cmd(void),
delete_cmd(void),
edit_cmd(void),
poke_daemon(void),
-check_error(const char *), parse_args(int c, char *v[]), die(int);
+check_error(const char *), parse_args(int c, char *v[]), die(int) ATTRIBUTE_NORETURN;
static int replace_cmd(void), hostset_cmd(void), hostget_cmd(void);
static char *host_specific_filename(const char *filename, int prefix);
static const char *tmp_path(void);
+static void usage(const char *msg) ATTRIBUTE_NORETURN;
static void usage(const char *msg) {
fprintf(stderr, "%s: usage error: %s\n", ProgramName, msg);
fprintf(stderr, "Usage:\n");
diff --git a/src/security.c b/src/security.c
index 7724b2f..c5fbc5e 100644
--- a/src/security.c
+++ b/src/security.c
@@ -29,8 +29,10 @@
#include <stdlib.h>
#include <string.h>
+#include "cronie_common.h"
#include "funcs.h"
#include "globals.h"
+#include "macros.h"
#ifdef WITH_PAM
# include <security/pam_appl.h>
@@ -54,7 +56,8 @@ static int pam_session_opened = 0; //global for open session
static int
cron_conv(int num_msg, const struct pam_message **msgm,
- struct pam_response **response, void *appdata_ptr)
+ struct pam_response **response ATTRIBUTE_UNUSED,
+ void *appdata_ptr ATTRIBUTE_UNUSED)
{
int i;
@@ -103,7 +106,8 @@ void cron_restore_default_security_context(void) {
#endif
}
-int cron_set_job_security_context(entry * e, user * u, char ***jobenv) {
+int cron_set_job_security_context(entry *e, user *u ATTRIBUTE_UNUSED,
+ char ***jobenv) {
time_t minutely_time = 0;
#ifdef WITH_PAM
int ret;
--
1.8.0.1