All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch 0/7] quiet gcc warnings
@ 2008-01-03 18:43 tmiller
  2008-01-03 18:43 ` [patch 1/7] quiet checkpolicy warnings tmiller
                   ` (7 more replies)
  0 siblings, 8 replies; 14+ messages in thread
From: tmiller @ 2008-01-03 18:43 UTC (permalink / raw)
  To: selinux; +Cc: method, sds

These patches fix a number of gcc warnings in the selinux userland
build process.  They allow everything but libsemanage to build with
-Werror.  The only thing in the way of libsemanage using -Werror is the
flex-generated scanner.  We could just drop a few of the -W flags for
libsemanage (like -Wundef) to make it pass.

-- 

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [patch 1/7] quiet checkpolicy warnings
  2008-01-03 18:43 [patch 0/7] quiet gcc warnings tmiller
@ 2008-01-03 18:43 ` tmiller
  2008-01-03 18:43 ` [patch 2/7] quiet libsepol qualifier warnings tmiller
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 14+ messages in thread
From: tmiller @ 2008-01-03 18:43 UTC (permalink / raw)
  To: selinux; +Cc: method, sds

Fix shadowed variable in dispol/dismod
Use bison instead of yacc to avoid an unused label warning.

---
 checkpolicy/Makefile      |    2 ++
 checkpolicy/test/dismod.c |    8 ++++----
 checkpolicy/test/dispol.c |    8 ++++----
 3 files changed, 10 insertions(+), 8 deletions(-)

Index: trunk/checkpolicy/Makefile
===================================================================
--- trunk.orig/checkpolicy/Makefile
+++ trunk/checkpolicy/Makefile
@@ -8,6 +8,8 @@ LIBDIR ?= $(PREFIX)/lib
 INCLUDEDIR ?= $(PREFIX)/include
 TARGETS = checkpolicy checkmodule
 
+YACC = bison -y
+
 CFLAGS ?= -g -Wall -O2 -pipe -fno-strict-aliasing
 
 override CFLAGS += -I. -I${INCLUDEDIR}
Index: trunk/checkpolicy/test/dismod.c
===================================================================
--- trunk.orig/checkpolicy/test/dismod.c
+++ trunk/checkpolicy/test/dismod.c
@@ -666,13 +666,13 @@ int display_avblock(int field, uint32_t 
 	return 0;
 }
 
-int display_handle_unknown(policydb_t * policydb, FILE * out_fp)
+int display_handle_unknown(policydb_t * p, FILE * out_fp)
 {
-	if (policydb->handle_unknown == ALLOW_UNKNOWN)
+	if (p->handle_unknown == ALLOW_UNKNOWN)
 		fprintf(out_fp, "Allow unknown classes and perms\n");
-	else if (policydb->handle_unknown == DENY_UNKNOWN)
+	else if (p->handle_unknown == DENY_UNKNOWN)
 		fprintf(out_fp, "Deny unknown classes and perms\n");
-	else if (policydb->handle_unknown == REJECT_UNKNOWN)
+	else if (p->handle_unknown == REJECT_UNKNOWN)
 		fprintf(out_fp, "Reject unknown classes and perms\n");
 	return 0;
 }
Index: trunk/checkpolicy/test/dispol.c
===================================================================
--- trunk.orig/checkpolicy/test/dispol.c
+++ trunk/checkpolicy/test/dispol.c
@@ -274,13 +274,13 @@ int display_cond_expressions(policydb_t 
 	return 1;
 }
 
-int display_handle_unknown(policydb_t * policydb, FILE * out_fp)
+int display_handle_unknown(policydb_t * p, FILE * out_fp)
 {
-	if (policydb->handle_unknown == ALLOW_UNKNOWN)
+	if (p->handle_unknown == ALLOW_UNKNOWN)
 		fprintf(out_fp, "Allow unknown classes and permisions\n");
-	else if (policydb->handle_unknown == DENY_UNKNOWN)
+	else if (p->handle_unknown == DENY_UNKNOWN)
 		fprintf(out_fp, "Deny unknown classes and permisions\n");
-	else if (policydb->handle_unknown == REJECT_UNKNOWN)
+	else if (p->handle_unknown == REJECT_UNKNOWN)
 		fprintf(out_fp, "Reject unknown classes and permisions\n");
 	return 0;
 }

-- 

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [patch 2/7] quiet libsepol qualifier warnings
  2008-01-03 18:43 [patch 0/7] quiet gcc warnings tmiller
  2008-01-03 18:43 ` [patch 1/7] quiet checkpolicy warnings tmiller
@ 2008-01-03 18:43 ` tmiller
  2008-01-03 18:43 ` [patch 3/7] quiet getdefaultcon warning tmiller
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 14+ messages in thread
From: tmiller @ 2008-01-03 18:43 UTC (permalink / raw)
  To: selinux; +Cc: method, sds

Fix discarded const warnings in mls.c by sprinkling const in mls_level_eq,
mls_level_dom and the ebitmap functions.

---
 libsepol/include/sepol/policydb/ebitmap.h   |   12 ++++++------
 libsepol/include/sepol/policydb/mls_types.h |    4 ++--
 libsepol/src/ebitmap.c                      |   12 ++++++------
 3 files changed, 14 insertions(+), 14 deletions(-)

Index: trunk/libsepol/include/sepol/policydb/ebitmap.h
===================================================================
--- trunk.orig/libsepol/include/sepol/policydb/ebitmap.h
+++ trunk/libsepol/include/sepol/policydb/ebitmap.h
@@ -73,12 +73,12 @@ static inline int ebitmap_node_get_bit(e
 #define ebitmap_for_each_bit(e, n, bit) \
 	for (bit = ebitmap_start(e, &n); bit < ebitmap_length(e); bit = ebitmap_next(&n, bit)) \
 
-extern int ebitmap_cmp(ebitmap_t * e1, ebitmap_t * e2);
-extern int ebitmap_or(ebitmap_t * dst, ebitmap_t * e1, ebitmap_t * e2);
-extern int ebitmap_union(ebitmap_t * dst, ebitmap_t * e1);
-extern int ebitmap_cpy(ebitmap_t * dst, ebitmap_t * src);
-extern int ebitmap_contains(ebitmap_t * e1, ebitmap_t * e2);
-extern int ebitmap_get_bit(ebitmap_t * e, unsigned int bit);
+extern int ebitmap_cmp(const ebitmap_t * e1, const ebitmap_t * e2);
+extern int ebitmap_or(ebitmap_t * dst, const ebitmap_t * e1, const ebitmap_t * e2);
+extern int ebitmap_union(ebitmap_t * dst, const ebitmap_t * e1);
+extern int ebitmap_cpy(ebitmap_t * dst, const ebitmap_t * src);
+extern int ebitmap_contains(const ebitmap_t * e1, const ebitmap_t * e2);
+extern int ebitmap_get_bit(const ebitmap_t * e, unsigned int bit);
 extern int ebitmap_set_bit(ebitmap_t * e, unsigned int bit, int value);
 extern void ebitmap_destroy(ebitmap_t * e);
 extern int ebitmap_read(ebitmap_t * e, void *fp);
Index: trunk/libsepol/include/sepol/policydb/mls_types.h
===================================================================
--- trunk.orig/libsepol/include/sepol/policydb/mls_types.h
+++ trunk/libsepol/include/sepol/policydb/mls_types.h
@@ -70,12 +70,12 @@ static inline void mls_level_destroy(str
 	mls_level_init(level);
 }
 
-static inline int mls_level_eq(struct mls_level *l1, struct mls_level *l2)
+static inline int mls_level_eq(const struct mls_level *l1, const struct mls_level *l2)
 {
 	return ((l1->sens == l2->sens) && ebitmap_cmp(&l1->cat, &l2->cat));
 }
 
-static inline int mls_level_dom(struct mls_level *l1, struct mls_level *l2)
+static inline int mls_level_dom(const struct mls_level *l1, const struct mls_level *l2)
 {
 	return ((l1->sens >= l2->sens) && ebitmap_contains(&l1->cat, &l2->cat));
 }
Index: trunk/libsepol/src/ebitmap.c
===================================================================
--- trunk.orig/libsepol/src/ebitmap.c
+++ trunk/libsepol/src/ebitmap.c
@@ -15,7 +15,7 @@
 #include "debug.h"
 #include "private.h"
 
-int ebitmap_or(ebitmap_t * dst, ebitmap_t * e1, ebitmap_t * e2)
+int ebitmap_or(ebitmap_t * dst, const ebitmap_t * e1, const ebitmap_t * e2)
 {
 	ebitmap_node_t *n1, *n2, *new, *prev;
 
@@ -58,7 +58,7 @@ int ebitmap_or(ebitmap_t * dst, ebitmap_
 	return 0;
 }
 
-int ebitmap_union(ebitmap_t * dst, ebitmap_t * e1)
+int ebitmap_union(ebitmap_t * dst, const ebitmap_t * e1)
 {
 	ebitmap_t tmp;
 
@@ -71,7 +71,7 @@ int ebitmap_union(ebitmap_t * dst, ebitm
 	return 0;
 }
 
-int ebitmap_cmp(ebitmap_t * e1, ebitmap_t * e2)
+int ebitmap_cmp(const ebitmap_t * e1, const ebitmap_t * e2)
 {
 	ebitmap_node_t *n1, *n2;
 
@@ -92,7 +92,7 @@ int ebitmap_cmp(ebitmap_t * e1, ebitmap_
 	return 1;
 }
 
-int ebitmap_cpy(ebitmap_t * dst, ebitmap_t * src)
+int ebitmap_cpy(ebitmap_t * dst, const ebitmap_t * src)
 {
 	ebitmap_node_t *n, *new, *prev;
 
@@ -121,7 +121,7 @@ int ebitmap_cpy(ebitmap_t * dst, ebitmap
 	return 0;
 }
 
-int ebitmap_contains(ebitmap_t * e1, ebitmap_t * e2)
+int ebitmap_contains(const ebitmap_t * e1, const ebitmap_t * e2)
 {
 	ebitmap_node_t *n1, *n2;
 
@@ -148,7 +148,7 @@ int ebitmap_contains(ebitmap_t * e1, ebi
 	return 1;
 }
 
-int ebitmap_get_bit(ebitmap_t * e, unsigned int bit)
+int ebitmap_get_bit(const ebitmap_t * e, unsigned int bit)
 {
 	ebitmap_node_t *n;
 

-- 

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [patch 3/7] quiet getdefaultcon warning
  2008-01-03 18:43 [patch 0/7] quiet gcc warnings tmiller
  2008-01-03 18:43 ` [patch 1/7] quiet checkpolicy warnings tmiller
  2008-01-03 18:43 ` [patch 2/7] quiet libsepol qualifier warnings tmiller
@ 2008-01-03 18:43 ` tmiller
  2008-01-03 18:43 ` [patch 4/7] quiet libsemanage scanner warnings tmiller
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 14+ messages in thread
From: tmiller @ 2008-01-03 18:43 UTC (permalink / raw)
  To: selinux; +Cc: method, sds

Fix uninitialized variable in error path if getseuserbyname() fails.

---
 libselinux/utils/getdefaultcon.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: trunk/libselinux/utils/getdefaultcon.c
===================================================================
--- trunk.orig/libselinux/utils/getdefaultcon.c
+++ trunk/libselinux/utils/getdefaultcon.c
@@ -57,7 +57,7 @@ int main(int argc, char **argv)
 	} else
 		cur_context = argv[optind + 1];
 
-	if (getseuserbyname(user, &seuser, &dlevel)==0) {
+	if ((ret = getseuserbyname(user, &seuser, &dlevel)) == 0) {
 		if (! level) level=dlevel;
 		if (role != NULL && role[0]) 
 			ret=get_default_context_with_rolelevel(seuser, role, level,cur_context,&usercon);

-- 

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [patch 4/7] quiet libsemanage scanner warnings
  2008-01-03 18:43 [patch 0/7] quiet gcc warnings tmiller
                   ` (2 preceding siblings ...)
  2008-01-03 18:43 ` [patch 3/7] quiet getdefaultcon warning tmiller
@ 2008-01-03 18:43 ` tmiller
  2008-01-03 18:43 ` [patch 5/7] quiet libsepol uninitialized variable warnings tmiller
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 14+ messages in thread
From: tmiller @ 2008-01-03 18:43 UTC (permalink / raw)
  To: selinux; +Cc: method, sds

Supress the generation of unused functions in the scanner.
There are still a few warnings about the generated scanner
code but that has to be fixed in flex.

---
 libsemanage/src/conf-scan.l |    1 +
 1 file changed, 1 insertion(+)

Index: trunk/libsemanage/src/conf-scan.l
===================================================================
--- trunk.orig/libsemanage/src/conf-scan.l
+++ trunk/libsemanage/src/conf-scan.l
@@ -32,6 +32,7 @@ int yywrap(void);
 %}
 
 %option stack prefix="semanage_"
+%option nounput noyy_push_state noyy_pop_state noyy_top_state
 
 %x arg
 

-- 

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [patch 5/7] quiet libsepol uninitialized variable warnings
  2008-01-03 18:43 [patch 0/7] quiet gcc warnings tmiller
                   ` (3 preceding siblings ...)
  2008-01-03 18:43 ` [patch 4/7] quiet libsemanage scanner warnings tmiller
@ 2008-01-03 18:43 ` tmiller
  2008-01-03 18:43 ` [patch 6/7] quiet policycoreutils warnings tmiller
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 14+ messages in thread
From: tmiller @ 2008-01-03 18:43 UTC (permalink / raw)
  To: selinux; +Cc: method, sds

Fix some gcc warnings about uninitialized variables.
For genusers.c, BADLINE() was being used inside an inner
loop that prevented it from working for those two cases.

---
 libsepol/src/genusers.c  |    7 +++++--
 libsepol/src/hierarchy.c |   11 ++++-------
 2 files changed, 9 insertions(+), 9 deletions(-)

Index: trunk/libsepol/src/genusers.c
===================================================================
--- trunk.orig/libsepol/src/genusers.c
+++ trunk/libsepol/src/genusers.c
@@ -117,17 +117,18 @@ static int load_users(struct policydb *p
 		} else
 			islist = 0;
 
+		oldc = 0;
 		do {
 			while (*p && isspace(*p))
 				p++;
 			if (!(*p))
-				BADLINE();
+				break;
 
 			q = p;
 			while (*p && *p != ';' && *p != '}' && !isspace(*p))
 				p++;
 			if (!(*p))
-				BADLINE();
+				break;
 			if (*p == '}')
 				islist = 0;
 			oldc = *p;
@@ -153,6 +154,8 @@ static int load_users(struct policydb *p
 					}
 			}
 		} while (islist);
+		if (oldc == 0)
+			BADLINE();
 
 		if (policydb->mls) {
 			context_struct_t context;
Index: trunk/libsepol/src/hierarchy.c
===================================================================
--- trunk.orig/libsepol/src/hierarchy.c
+++ trunk/libsepol/src/hierarchy.c
@@ -130,7 +130,7 @@ static int check_avtab_hierarchy_callbac
 	avtab_key_t key;
 	avtab_datum_t *avdatump;
 	hierarchy_args_t *a;
-	uint32_t av;
+	uint32_t av = 0;
 	type_datum_t *t = NULL, *t2 = NULL;
 
 	if (!(k->specified & AVTAB_ALLOWED)) {
@@ -164,8 +164,7 @@ static int check_avtab_hierarchy_callbac
 				return 0;
 			}
 			av = avdatump->data;
-		} else
-			av = 0;
+		}
 		if (a->opt_cond_list) {
 			/* if a conditional list is present search it before continuing */
 			avdatump = cond_av_list_search(&key, a->opt_cond_list);
@@ -202,8 +201,7 @@ static int check_avtab_hierarchy_callbac
 				return 0;
 			}
 			av = avdatump->data;
-		} else
-			av = 0;
+		}
 		if (a->opt_cond_list) {
 			/* if a conditional list is present search it before continuing */
 			avdatump = cond_av_list_search(&key, a->opt_cond_list);
@@ -228,8 +226,7 @@ static int check_avtab_hierarchy_callbac
 				return 0;
 			}
 			av = avdatump->data;
-		} else
-			av = 0;
+		}
 		if (a->opt_cond_list) {
 			/* if a conditional list is present search it before continuing */
 			avdatump = cond_av_list_search(&key, a->opt_cond_list);

-- 

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [patch 6/7] quiet policycoreutils warnings
  2008-01-03 18:43 [patch 0/7] quiet gcc warnings tmiller
                   ` (4 preceding siblings ...)
  2008-01-03 18:43 ` [patch 5/7] quiet libsepol uninitialized variable warnings tmiller
@ 2008-01-03 18:43 ` tmiller
  2008-01-03 18:43 ` [patch 7/7] Use -Werror tmiller
  2008-01-09 18:47 ` [patch 0/7] quiet gcc warnings Todd Miller
  7 siblings, 0 replies; 14+ messages in thread
From: tmiller @ 2008-01-03 18:43 UTC (permalink / raw)
  To: selinux; +Cc: method, sds

Avoid using "log" as a variable name, it conflicts with the gcc
log() builtin.

Fix gcc uninitialized variable warning false positives.

---
 policycoreutils/audit2why/audit2why.c         |    2 +-
 policycoreutils/semodule/semodule.c           |    4 ++--
 policycoreutils/semodule_deps/semodule_deps.c |   23 +++++++++++++----------
 policycoreutils/setfiles/setfiles.c           |    6 +++---
 4 files changed, 19 insertions(+), 16 deletions(-)

Index: trunk/policycoreutils/audit2why/audit2why.c
===================================================================
--- trunk.orig/policycoreutils/audit2why/audit2why.c
+++ trunk/policycoreutils/audit2why/audit2why.c
@@ -28,7 +28,7 @@ int main(int argc, char **argv)
 	char *buffer = NULL, *bufcopy = NULL;
 	unsigned int lineno = 0;
 	size_t len = 0, bufcopy_len = 0;
-	FILE *fp;
+	FILE *fp = NULL;
 	int opt, rc, set_path = 0;
 	char *p, *scon, *tcon, *tclassstr, *permstr;
 	sepol_security_id_t ssid, tsid;
Index: trunk/policycoreutils/semodule/semodule.c
===================================================================
--- trunk.orig/policycoreutils/semodule/semodule.c
+++ trunk/policycoreutils/semodule/semodule.c
@@ -339,8 +339,8 @@ int main(int argc, char *argv[])
 	for (i = 0; i < num_commands; i++) {
 		enum client_modes mode = commands[i].mode;
 		char *mode_arg = commands[i].arg;
-		char *data;
-		size_t data_len;
+		char *data = NULL;
+		size_t data_len = 0;
 		if (mode == INSTALL_M || mode == UPGRADE_M || mode == BASE_M) {
 			if ((data_len = map_file(mode_arg, &data)) == 0) {
 				fprintf(stderr,
Index: trunk/policycoreutils/semodule_deps/semodule_deps.c
===================================================================
--- trunk.orig/policycoreutils/semodule_deps/semodule_deps.c
+++ trunk/policycoreutils/semodule_deps/semodule_deps.c
@@ -139,7 +139,7 @@ static sepol_module_package_t *load_modu
  *           of the policy.
  *  - levels / cats: can't be required or used in modules.
  */
-static int generate_requires(policydb_t * p, hashtab_t * r)
+static hashtab_t generate_requires(policydb_t * p)
 {
 	avrule_block_t *block;
 	avrule_decl_t *decl;
@@ -154,7 +154,7 @@ static int generate_requires(policydb_t 
 
 	mods = hashtab_create(reqsymhash, reqsymcmp, 64);
 	if (mods == NULL)
-		return -1;
+		return NULL;
 
 	for (block = p->global; block != NULL; block = block->next) {
 		if (block->flags & AVRULE_OPTIONAL)
@@ -196,14 +196,14 @@ static int generate_requires(policydb_t 
 								   reqsymcmp,
 								   64);
 						if (reqs == NULL) {
-							return -1;
+							return NULL;
 						}
 						ret =
 						    hashtab_insert(mods,
 								   mod_name,
 								   reqs);
 						if (ret != SEPOL_OK)
-							return ret;
+							return NULL;
 					}
 					ret =
 					    hashtab_insert(reqs, req_name,
@@ -211,16 +211,14 @@ static int generate_requires(policydb_t 
 					if (!
 					    (ret == SEPOL_EEXIST
 					     || ret == SEPOL_OK))
-						return -1;
+						return NULL;
 				}
 			}
 
 		}
 	}
 
-	*r = mods;
-
-	return 0;
+	return mods;
 }
 
 static void free_requires(hashtab_t req)
@@ -323,6 +321,7 @@ int main(int argc, char **argv)
 	int verbose = 0, exclude_base = 1, command = SHOW_DEPS;
 	char *basename;
 	sepol_module_package_t *base, **mods;
+	policydb_t *p;
 	hashtab_t req;
 
 	while ((ch = getopt(argc, argv, "vgb")) != EOF) {
@@ -383,8 +382,12 @@ int main(int argc, char **argv)
 		exit(1);
 	}
 
-	if (generate_requires
-	    ((policydb_t *) sepol_module_package_get_policy(base), &req) < 0)
+	p = (policydb_t *) sepol_module_package_get_policy(base);
+	if (p == NULL)
+		exit(1);
+
+	req = generate_requires(p);
+	if (req == NULL)
 		exit(1);
 
 	if (command == SHOW_DEPS)
Index: trunk/policycoreutils/setfiles/setfiles.c
===================================================================
--- trunk.orig/policycoreutils/setfiles/setfiles.c
+++ trunk/policycoreutils/setfiles/setfiles.c
@@ -53,7 +53,7 @@ static int change = 1;
 static int quiet = 0;
 static int ignore_enoent;
 static int verbose = 0;
-static int log = 0;
+static int logging = 0;
 static int warn_no_match = 0;
 static char *rootpath = NULL;
 static int rootpathlen = 0;
@@ -519,7 +519,7 @@ static int restore(const char *file)
 		}
 	}
 
-	if (log && !user_only_changed) {
+	if (logging && !user_only_changed) {
 		if (context)
 			syslog(LOG_INFO, "relabeling %s from %s to %s\n",
 			       my_file, context, newcon);
@@ -858,7 +858,7 @@ int main(int argc, char **argv)
 			ignore_enoent = 1;
 			break;
 		case 'l':
-			log = 1;
+			logging = 1;
 			break;
 		case 'F':
 			force = 1;

-- 

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [patch 7/7] Use -Werror
  2008-01-03 18:43 [patch 0/7] quiet gcc warnings tmiller
                   ` (5 preceding siblings ...)
  2008-01-03 18:43 ` [patch 6/7] quiet policycoreutils warnings tmiller
@ 2008-01-03 18:43 ` tmiller
  2008-01-07 18:06   ` Stephen Smalley
  2008-01-09 18:47 ` [patch 0/7] quiet gcc warnings Todd Miller
  7 siblings, 1 reply; 14+ messages in thread
From: tmiller @ 2008-01-03 18:43 UTC (permalink / raw)
  To: selinux; +Cc: method, sds

Add -Werror to Makefiles

---
 checkpolicy/Makefile                      |    2 +-
 libselinux/src/Makefile                   |    2 +-
 libsemanage/src/Makefile                  |    2 +-
 libsepol/src/Makefile                     |    2 +-
 policycoreutils/audit2why/Makefile        |    2 +-
 policycoreutils/load_policy/Makefile      |    2 +-
 policycoreutils/newrole/Makefile          |    2 +-
 policycoreutils/restorecond/Makefile      |    2 +-
 policycoreutils/run_init/Makefile         |    2 +-
 policycoreutils/secon/Makefile            |    2 +-
 policycoreutils/semodule/Makefile         |    2 +-
 policycoreutils/semodule_deps/Makefile    |    2 +-
 policycoreutils/semodule_expand/Makefile  |    2 +-
 policycoreutils/semodule_link/Makefile    |    2 +-
 policycoreutils/semodule_package/Makefile |    2 +-
 policycoreutils/sestatus/Makefile         |    2 +-
 policycoreutils/setfiles/Makefile         |    2 +-
 policycoreutils/setsebool/Makefile        |    2 +-
 18 files changed, 18 insertions(+), 18 deletions(-)

Index: trunk/checkpolicy/Makefile
===================================================================
--- trunk.orig/checkpolicy/Makefile
+++ trunk/checkpolicy/Makefile
@@ -10,7 +10,7 @@ TARGETS = checkpolicy checkmodule
 
 YACC = bison -y
 
-CFLAGS ?= -g -Wall -O2 -pipe -fno-strict-aliasing
+CFLAGS ?= -g -Wall -Werror -O2 -pipe -fno-strict-aliasing
 
 override CFLAGS += -I. -I${INCLUDEDIR}
 
Index: trunk/libselinux/src/Makefile
===================================================================
--- trunk.orig/libselinux/src/Makefile
+++ trunk/libselinux/src/Makefile
@@ -32,7 +32,7 @@ SRCS= $(filter-out $(UNUSED_SRCS), $(fil
 
 OBJS= $(patsubst %.c,%.o,$(SRCS))
 LOBJS= $(patsubst %.c,%.lo,$(SRCS))
-CFLAGS ?= -Wall -W -Wundef -Wmissing-noreturn -Wmissing-format-attribute
+CFLAGS ?= -Wall -W -Wundef -Wmissing-noreturn -Wmissing-format-attribute -Werror
 override CFLAGS += -I../include -I$(INCLUDEDIR) -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 $(EMFLAGS)
 RANLIB=ranlib
 
Index: trunk/libsemanage/src/Makefile
===================================================================
--- trunk.orig/libsemanage/src/Makefile
+++ trunk/libsemanage/src/Makefile
@@ -31,7 +31,7 @@ SWIGFILES=$(SWIGSO) semanage.py 
 LIBSO=$(TARGET).$(LIBVERSION)
 OBJS= $(patsubst %.c,%.o,$(filter-out $(SWIGCOUT),$(wildcard *.c))) conf-scan.o conf-parse.o
 LOBJS= $(patsubst %.c,%.lo,$(filter-out $(SWIGCOUT),$(wildcard *.c))) conf-scan.lo conf-parse.lo
-CFLAGS ?= -Wall -W -Wundef -Wmissing-noreturn -Wmissing-format-attribute -Wno-unused-parameter
+CFLAGS ?= -Wall -W Wundef -Wmissing-noreturn -Wmissing-format-attribute -Wno-unused-parameter
 
 override CFLAGS += -I../include -I$(INCLUDEDIR) -D_GNU_SOURCE 
 
Index: trunk/libsepol/src/Makefile
===================================================================
--- trunk.orig/libsepol/src/Makefile
+++ trunk/libsepol/src/Makefile
@@ -10,7 +10,7 @@ TARGET=libsepol.so
 LIBSO=$(TARGET).$(LIBVERSION)
 OBJS= $(patsubst %.c,%.o,$(wildcard *.c))
 LOBJS= $(patsubst %.c,%.lo,$(wildcard *.c))
-CFLAGS ?= -Wall -W -Wundef -Wmissing-noreturn -Wmissing-format-attribute
+CFLAGS ?= -Wall -W -Wundef -Wmissing-noreturn -Wmissing-format-attribute -Werror
 override CFLAGS += -I. -I../include -D_GNU_SOURCE
 
 all: $(LIBA) $(LIBSO)
Index: trunk/policycoreutils/audit2why/Makefile
===================================================================
--- trunk.orig/policycoreutils/audit2why/Makefile
+++ trunk/policycoreutils/audit2why/Makefile
@@ -7,7 +7,7 @@ LOCALEDIR ?= /usr/share/locale
 INCLUDEDIR ?= ${PREFIX}/include
 
 
-CFLAGS ?= -Werror -Wall -W
+CFLAGS ?= -Werror -Wall -W -Werror
 override CFLAGS += -I$(INCLUDEDIR)
 LDLIBS = ${LIBDIR}/libsepol.a -lselinux -L$(LIBDIR)
 
Index: trunk/policycoreutils/load_policy/Makefile
===================================================================
--- trunk.orig/policycoreutils/load_policy/Makefile
+++ trunk/policycoreutils/load_policy/Makefile
@@ -4,7 +4,7 @@ SBINDIR ?= $(PREFIX)/sbin
 MANDIR ?= $(PREFIX)/share/man
 LOCALEDIR ?= /usr/share/locale
 
-CFLAGS ?= -Werror -Wall -W
+CFLAGS ?= -Werror -Wall -W -Werror
 override CFLAGS += $(LDFLAGS) -I$(PREFIX)/include -DUSE_NLS -DLOCALEDIR="\"$(LOCALEDIR)\"" -DPACKAGE="\"policycoreutils\""
 LDLIBS += -lsepol -lselinux -L$(PREFIX)/lib
 
Index: trunk/policycoreutils/newrole/Makefile
===================================================================
--- trunk.orig/policycoreutils/newrole/Makefile
+++ trunk/policycoreutils/newrole/Makefile
@@ -20,7 +20,7 @@ NAMESPACE_PRIV ?= n
 LSPP_PRIV ?= n
 VERSION = $(shell cat ../VERSION)
 
-CFLAGS ?= -Werror -Wall -W
+CFLAGS ?= -Werror -Wall -W -Werror
 EXTRA_OBJS =
 override CFLAGS += -DVERSION=\"$(VERSION)\" $(LDFLAGS) -I$(PREFIX)/include -DUSE_NLS -DLOCALEDIR="\"$(LOCALEDIR)\"" -DPACKAGE="\"policycoreutils\""
 LDLIBS += -lselinux -L$(PREFIX)/lib
Index: trunk/policycoreutils/restorecond/Makefile
===================================================================
--- trunk.orig/policycoreutils/restorecond/Makefile
+++ trunk/policycoreutils/restorecond/Makefile
@@ -5,7 +5,7 @@ MANDIR = $(PREFIX)/share/man
 INITDIR = $(DESTDIR)/etc/rc.d/init.d
 SELINUXDIR = $(DESTDIR)/etc/selinux
 
-CFLAGS ?= -g -Werror -Wall -W
+CFLAGS ?= -g -Werror -Wall -W -Werror
 override CFLAGS += -I$(PREFIX)/include -D_FILE_OFFSET_BITS=64
 LDLIBS += -lselinux -L$(PREFIX)/lib
 
Index: trunk/policycoreutils/run_init/Makefile
===================================================================
--- trunk.orig/policycoreutils/run_init/Makefile
+++ trunk/policycoreutils/run_init/Makefile
@@ -8,7 +8,7 @@ LOCALEDIR ?= /usr/share/locale
 PAMH = $(shell ls /usr/include/security/pam_appl.h 2>/dev/null)
 AUDITH = $(shell ls /usr/include/libaudit.h 2>/dev/null)
 
-CFLAGS ?= -Werror -Wall -W
+CFLAGS ?= -Werror -Wall -W -Werror
 override CFLAGS += -I$(PREFIX)/include -DUSE_NLS -DLOCALEDIR="\"$(LOCALEDIR)\"" -DPACKAGE="\"policycoreutils\""
 LDLIBS += -lselinux -L$(PREFIX)/lib
 ifeq (${PAMH}, /usr/include/security/pam_appl.h)
Index: trunk/policycoreutils/secon/Makefile
===================================================================
--- trunk.orig/policycoreutils/secon/Makefile
+++ trunk/policycoreutils/secon/Makefile
@@ -5,7 +5,7 @@ BINDIR ?= $(PREFIX)/bin
 MANDIR ?= $(PREFIX)/share/man
 LIBDIR ?= ${PREFIX}/lib
 
-WARNS=-W -Wall -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Wno-format-zero-length -Wformat-nonliteral -Wformat-security -Wfloat-equal
+WARNS=-W -Wall -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Wno-format-zero-length -Wformat-nonliteral -Wformat-security -Wfloat-equal -Werror
 VERSION = $(shell cat ../VERSION)
 CFLAGS ?= $(WARNS) -O1
 override CFLAGS += -DVERSION=\"$(VERSION)\" -I$(INCLUDEDIR) 
Index: trunk/policycoreutils/semodule/Makefile
===================================================================
--- trunk.orig/policycoreutils/semodule/Makefile
+++ trunk/policycoreutils/semodule/Makefile
@@ -5,7 +5,7 @@ SBINDIR ?= $(PREFIX)/sbin
 MANDIR = $(PREFIX)/share/man
 LIBDIR ?= ${PREFIX}/lib
 
-CFLAGS ?= -Werror -Wall -W
+CFLAGS ?= -Werror -Wall -W -Werror
 override CFLAGS += -I$(INCLUDEDIR)
 LDLIBS = -lsepol -lselinux -lsemanage -L$(LIBDIR)
 SEMODULE_OBJS = semodule.o
Index: trunk/policycoreutils/semodule_deps/Makefile
===================================================================
--- trunk.orig/policycoreutils/semodule_deps/Makefile
+++ trunk/policycoreutils/semodule_deps/Makefile
@@ -5,7 +5,7 @@ BINDIR ?= $(PREFIX)/bin
 LIBDIR ?= ${PREFIX}/lib
 MANDIR ?= $(PREFIX)/share/man
 
-CFLAGS ?= -Werror -Wall -W
+CFLAGS ?= -Werror -Wall -W -Werror
 override CFLAGS += -I$(INCLUDEDIR)
 LDLIBS = $(LIBDIR)/libsepol.a
 
Index: trunk/policycoreutils/semodule_expand/Makefile
===================================================================
--- trunk.orig/policycoreutils/semodule_expand/Makefile
+++ trunk/policycoreutils/semodule_expand/Makefile
@@ -5,7 +5,7 @@ BINDIR ?= $(PREFIX)/bin
 LIBDIR ?= ${PREFIX}/lib
 MANDIR ?= $(PREFIX)/share/man
 
-CFLAGS ?= -Werror -Wall -W
+CFLAGS ?= -Werror -Wall -W -Werror
 override CFLAGS += -I$(INCLUDEDIR)
 LDLIBS = -lsepol -lselinux -L$(LIBDIR)
 
Index: trunk/policycoreutils/semodule_link/Makefile
===================================================================
--- trunk.orig/policycoreutils/semodule_link/Makefile
+++ trunk/policycoreutils/semodule_link/Makefile
@@ -5,7 +5,7 @@ BINDIR ?= $(PREFIX)/bin
 MANDIR ?= $(PREFIX)/share/man
 LIBDIR ?= ${PREFIX}/lib
 
-CFLAGS ?= -Werror -Wall -W
+CFLAGS ?= -Werror -Wall -W -Werror
 override CFLAGS += -I$(INCLUDEDIR)
 LDLIBS = -lsepol -lselinux -L$(LIBDIR)
 
Index: trunk/policycoreutils/semodule_package/Makefile
===================================================================
--- trunk.orig/policycoreutils/semodule_package/Makefile
+++ trunk/policycoreutils/semodule_package/Makefile
@@ -5,7 +5,7 @@ BINDIR ?= $(PREFIX)/bin
 LIBDIR ?= ${PREFIX}/lib
 MANDIR ?= $(PREFIX)/share/man
 
-CFLAGS ?= -Werror -Wall -W
+CFLAGS ?= -Werror -Wall -W -Werror
 override CFLAGS += -I$(INCLUDEDIR)
 LDLIBS = -lsepol -lselinux -L$(LIBDIR)
 
Index: trunk/policycoreutils/sestatus/Makefile
===================================================================
--- trunk.orig/policycoreutils/sestatus/Makefile
+++ trunk/policycoreutils/sestatus/Makefile
@@ -5,7 +5,7 @@ MANDIR = $(PREFIX)/share/man
 ETCDIR ?= $(DESTDIR)/etc
 LIBDIR ?= ${PREFIX}/lib
 
-CFLAGS = -Werror -Wall -W
+CFLAGS = -Werror -Wall -W -Werror
 override CFLAGS += -I$(PREFIX)/include -D_FILE_OFFSET_BITS=64
 LDLIBS = -lselinux -L$(LIBDIR)
 
Index: trunk/policycoreutils/setfiles/Makefile
===================================================================
--- trunk.orig/policycoreutils/setfiles/Makefile
+++ trunk/policycoreutils/setfiles/Makefile
@@ -6,7 +6,7 @@ LIBDIR ?= $(PREFIX)/lib
 
 AUDITH = $(shell ls /usr/include/libaudit.h 2>/dev/null)
 
-CFLAGS = -Werror -Wall -W 
+CFLAGS = -Werror -Wall -W  -Werror
 override CFLAGS += -D_FILE_OFFSET_BITS=64 -I$(PREFIX)/include
 LDLIBS = -lselinux -lsepol -L$(LIBDIR)
 
Index: trunk/policycoreutils/setsebool/Makefile
===================================================================
--- trunk.orig/policycoreutils/setsebool/Makefile
+++ trunk/policycoreutils/setsebool/Makefile
@@ -5,7 +5,7 @@ SBINDIR ?= $(PREFIX)/sbin
 MANDIR = $(PREFIX)/share/man
 LIBDIR ?= ${PREFIX}/lib
 
-CFLAGS ?= -Werror -Wall -W
+CFLAGS ?= -Werror -Wall -W -Werror
 override CFLAGS += -I$(INCLUDEDIR)
 LDLIBS = -lsepol -lselinux -lsemanage -L$(LIBDIR)
 SETSEBOOL_OBJS = setsebool.o

-- 

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [patch 7/7] Use -Werror
  2008-01-03 18:43 ` [patch 7/7] Use -Werror tmiller
@ 2008-01-07 18:06   ` Stephen Smalley
  2008-01-07 18:30     ` Joshua Brindle
  0 siblings, 1 reply; 14+ messages in thread
From: Stephen Smalley @ 2008-01-07 18:06 UTC (permalink / raw)
  To: tmiller; +Cc: selinux, method


On Thu, 2008-01-03 at 13:43 -0500, tmiller@tresys.com wrote:
> plain text document attachment (Werror.patch)
> Add -Werror to Makefiles

A bit overzealous though - some of them already had -Werror in CFLAGS.

Otherwise, looks fine.

> 
> ---
>  checkpolicy/Makefile                      |    2 +-
>  libselinux/src/Makefile                   |    2 +-
>  libsemanage/src/Makefile                  |    2 +-
>  libsepol/src/Makefile                     |    2 +-
>  policycoreutils/audit2why/Makefile        |    2 +-
>  policycoreutils/load_policy/Makefile      |    2 +-
>  policycoreutils/newrole/Makefile          |    2 +-
>  policycoreutils/restorecond/Makefile      |    2 +-
>  policycoreutils/run_init/Makefile         |    2 +-
>  policycoreutils/secon/Makefile            |    2 +-
>  policycoreutils/semodule/Makefile         |    2 +-
>  policycoreutils/semodule_deps/Makefile    |    2 +-
>  policycoreutils/semodule_expand/Makefile  |    2 +-
>  policycoreutils/semodule_link/Makefile    |    2 +-
>  policycoreutils/semodule_package/Makefile |    2 +-
>  policycoreutils/sestatus/Makefile         |    2 +-
>  policycoreutils/setfiles/Makefile         |    2 +-
>  policycoreutils/setsebool/Makefile        |    2 +-
>  18 files changed, 18 insertions(+), 18 deletions(-)
> 
> Index: trunk/checkpolicy/Makefile
> ===================================================================
> --- trunk.orig/checkpolicy/Makefile
> +++ trunk/checkpolicy/Makefile
> @@ -10,7 +10,7 @@ TARGETS = checkpolicy checkmodule
>  
>  YACC = bison -y
>  
> -CFLAGS ?= -g -Wall -O2 -pipe -fno-strict-aliasing
> +CFLAGS ?= -g -Wall -Werror -O2 -pipe -fno-strict-aliasing
>  
>  override CFLAGS += -I. -I${INCLUDEDIR}
>  
> Index: trunk/libselinux/src/Makefile
> ===================================================================
> --- trunk.orig/libselinux/src/Makefile
> +++ trunk/libselinux/src/Makefile
> @@ -32,7 +32,7 @@ SRCS= $(filter-out $(UNUSED_SRCS), $(fil
>  
>  OBJS= $(patsubst %.c,%.o,$(SRCS))
>  LOBJS= $(patsubst %.c,%.lo,$(SRCS))
> -CFLAGS ?= -Wall -W -Wundef -Wmissing-noreturn -Wmissing-format-attribute
> +CFLAGS ?= -Wall -W -Wundef -Wmissing-noreturn -Wmissing-format-attribute -Werror
>  override CFLAGS += -I../include -I$(INCLUDEDIR) -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 $(EMFLAGS)
>  RANLIB=ranlib
>  
> Index: trunk/libsemanage/src/Makefile
> ===================================================================
> --- trunk.orig/libsemanage/src/Makefile
> +++ trunk/libsemanage/src/Makefile
> @@ -31,7 +31,7 @@ SWIGFILES=$(SWIGSO) semanage.py 
>  LIBSO=$(TARGET).$(LIBVERSION)
>  OBJS= $(patsubst %.c,%.o,$(filter-out $(SWIGCOUT),$(wildcard *.c))) conf-scan.o conf-parse.o
>  LOBJS= $(patsubst %.c,%.lo,$(filter-out $(SWIGCOUT),$(wildcard *.c))) conf-scan.lo conf-parse.lo
> -CFLAGS ?= -Wall -W -Wundef -Wmissing-noreturn -Wmissing-format-attribute -Wno-unused-parameter
> +CFLAGS ?= -Wall -W Wundef -Wmissing-noreturn -Wmissing-format-attribute -Wno-unused-parameter
>  
>  override CFLAGS += -I../include -I$(INCLUDEDIR) -D_GNU_SOURCE 
>  
> Index: trunk/libsepol/src/Makefile
> ===================================================================
> --- trunk.orig/libsepol/src/Makefile
> +++ trunk/libsepol/src/Makefile
> @@ -10,7 +10,7 @@ TARGET=libsepol.so
>  LIBSO=$(TARGET).$(LIBVERSION)
>  OBJS= $(patsubst %.c,%.o,$(wildcard *.c))
>  LOBJS= $(patsubst %.c,%.lo,$(wildcard *.c))
> -CFLAGS ?= -Wall -W -Wundef -Wmissing-noreturn -Wmissing-format-attribute
> +CFLAGS ?= -Wall -W -Wundef -Wmissing-noreturn -Wmissing-format-attribute -Werror
>  override CFLAGS += -I. -I../include -D_GNU_SOURCE
>  
>  all: $(LIBA) $(LIBSO)
> Index: trunk/policycoreutils/audit2why/Makefile
> ===================================================================
> --- trunk.orig/policycoreutils/audit2why/Makefile
> +++ trunk/policycoreutils/audit2why/Makefile
> @@ -7,7 +7,7 @@ LOCALEDIR ?= /usr/share/locale
>  INCLUDEDIR ?= ${PREFIX}/include
>  
> 
> -CFLAGS ?= -Werror -Wall -W
> +CFLAGS ?= -Werror -Wall -W -Werror
>  override CFLAGS += -I$(INCLUDEDIR)
>  LDLIBS = ${LIBDIR}/libsepol.a -lselinux -L$(LIBDIR)
>  
> Index: trunk/policycoreutils/load_policy/Makefile
> ===================================================================
> --- trunk.orig/policycoreutils/load_policy/Makefile
> +++ trunk/policycoreutils/load_policy/Makefile
> @@ -4,7 +4,7 @@ SBINDIR ?= $(PREFIX)/sbin
>  MANDIR ?= $(PREFIX)/share/man
>  LOCALEDIR ?= /usr/share/locale
>  
> -CFLAGS ?= -Werror -Wall -W
> +CFLAGS ?= -Werror -Wall -W -Werror
>  override CFLAGS += $(LDFLAGS) -I$(PREFIX)/include -DUSE_NLS -DLOCALEDIR="\"$(LOCALEDIR)\"" -DPACKAGE="\"policycoreutils\""
>  LDLIBS += -lsepol -lselinux -L$(PREFIX)/lib
>  
> Index: trunk/policycoreutils/newrole/Makefile
> ===================================================================
> --- trunk.orig/policycoreutils/newrole/Makefile
> +++ trunk/policycoreutils/newrole/Makefile
> @@ -20,7 +20,7 @@ NAMESPACE_PRIV ?= n
>  LSPP_PRIV ?= n
>  VERSION = $(shell cat ../VERSION)
>  
> -CFLAGS ?= -Werror -Wall -W
> +CFLAGS ?= -Werror -Wall -W -Werror
>  EXTRA_OBJS =
>  override CFLAGS += -DVERSION=\"$(VERSION)\" $(LDFLAGS) -I$(PREFIX)/include -DUSE_NLS -DLOCALEDIR="\"$(LOCALEDIR)\"" -DPACKAGE="\"policycoreutils\""
>  LDLIBS += -lselinux -L$(PREFIX)/lib
> Index: trunk/policycoreutils/restorecond/Makefile
> ===================================================================
> --- trunk.orig/policycoreutils/restorecond/Makefile
> +++ trunk/policycoreutils/restorecond/Makefile
> @@ -5,7 +5,7 @@ MANDIR = $(PREFIX)/share/man
>  INITDIR = $(DESTDIR)/etc/rc.d/init.d
>  SELINUXDIR = $(DESTDIR)/etc/selinux
>  
> -CFLAGS ?= -g -Werror -Wall -W
> +CFLAGS ?= -g -Werror -Wall -W -Werror
>  override CFLAGS += -I$(PREFIX)/include -D_FILE_OFFSET_BITS=64
>  LDLIBS += -lselinux -L$(PREFIX)/lib
>  
> Index: trunk/policycoreutils/run_init/Makefile
> ===================================================================
> --- trunk.orig/policycoreutils/run_init/Makefile
> +++ trunk/policycoreutils/run_init/Makefile
> @@ -8,7 +8,7 @@ LOCALEDIR ?= /usr/share/locale
>  PAMH = $(shell ls /usr/include/security/pam_appl.h 2>/dev/null)
>  AUDITH = $(shell ls /usr/include/libaudit.h 2>/dev/null)
>  
> -CFLAGS ?= -Werror -Wall -W
> +CFLAGS ?= -Werror -Wall -W -Werror
>  override CFLAGS += -I$(PREFIX)/include -DUSE_NLS -DLOCALEDIR="\"$(LOCALEDIR)\"" -DPACKAGE="\"policycoreutils\""
>  LDLIBS += -lselinux -L$(PREFIX)/lib
>  ifeq (${PAMH}, /usr/include/security/pam_appl.h)
> Index: trunk/policycoreutils/secon/Makefile
> ===================================================================
> --- trunk.orig/policycoreutils/secon/Makefile
> +++ trunk/policycoreutils/secon/Makefile
> @@ -5,7 +5,7 @@ BINDIR ?= $(PREFIX)/bin
>  MANDIR ?= $(PREFIX)/share/man
>  LIBDIR ?= ${PREFIX}/lib
>  
> -WARNS=-W -Wall -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Wno-format-zero-length -Wformat-nonliteral -Wformat-security -Wfloat-equal
> +WARNS=-W -Wall -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Wno-format-zero-length -Wformat-nonliteral -Wformat-security -Wfloat-equal -Werror
>  VERSION = $(shell cat ../VERSION)
>  CFLAGS ?= $(WARNS) -O1
>  override CFLAGS += -DVERSION=\"$(VERSION)\" -I$(INCLUDEDIR) 
> Index: trunk/policycoreutils/semodule/Makefile
> ===================================================================
> --- trunk.orig/policycoreutils/semodule/Makefile
> +++ trunk/policycoreutils/semodule/Makefile
> @@ -5,7 +5,7 @@ SBINDIR ?= $(PREFIX)/sbin
>  MANDIR = $(PREFIX)/share/man
>  LIBDIR ?= ${PREFIX}/lib
>  
> -CFLAGS ?= -Werror -Wall -W
> +CFLAGS ?= -Werror -Wall -W -Werror
>  override CFLAGS += -I$(INCLUDEDIR)
>  LDLIBS = -lsepol -lselinux -lsemanage -L$(LIBDIR)
>  SEMODULE_OBJS = semodule.o
> Index: trunk/policycoreutils/semodule_deps/Makefile
> ===================================================================
> --- trunk.orig/policycoreutils/semodule_deps/Makefile
> +++ trunk/policycoreutils/semodule_deps/Makefile
> @@ -5,7 +5,7 @@ BINDIR ?= $(PREFIX)/bin
>  LIBDIR ?= ${PREFIX}/lib
>  MANDIR ?= $(PREFIX)/share/man
>  
> -CFLAGS ?= -Werror -Wall -W
> +CFLAGS ?= -Werror -Wall -W -Werror
>  override CFLAGS += -I$(INCLUDEDIR)
>  LDLIBS = $(LIBDIR)/libsepol.a
>  
> Index: trunk/policycoreutils/semodule_expand/Makefile
> ===================================================================
> --- trunk.orig/policycoreutils/semodule_expand/Makefile
> +++ trunk/policycoreutils/semodule_expand/Makefile
> @@ -5,7 +5,7 @@ BINDIR ?= $(PREFIX)/bin
>  LIBDIR ?= ${PREFIX}/lib
>  MANDIR ?= $(PREFIX)/share/man
>  
> -CFLAGS ?= -Werror -Wall -W
> +CFLAGS ?= -Werror -Wall -W -Werror
>  override CFLAGS += -I$(INCLUDEDIR)
>  LDLIBS = -lsepol -lselinux -L$(LIBDIR)
>  
> Index: trunk/policycoreutils/semodule_link/Makefile
> ===================================================================
> --- trunk.orig/policycoreutils/semodule_link/Makefile
> +++ trunk/policycoreutils/semodule_link/Makefile
> @@ -5,7 +5,7 @@ BINDIR ?= $(PREFIX)/bin
>  MANDIR ?= $(PREFIX)/share/man
>  LIBDIR ?= ${PREFIX}/lib
>  
> -CFLAGS ?= -Werror -Wall -W
> +CFLAGS ?= -Werror -Wall -W -Werror
>  override CFLAGS += -I$(INCLUDEDIR)
>  LDLIBS = -lsepol -lselinux -L$(LIBDIR)
>  
> Index: trunk/policycoreutils/semodule_package/Makefile
> ===================================================================
> --- trunk.orig/policycoreutils/semodule_package/Makefile
> +++ trunk/policycoreutils/semodule_package/Makefile
> @@ -5,7 +5,7 @@ BINDIR ?= $(PREFIX)/bin
>  LIBDIR ?= ${PREFIX}/lib
>  MANDIR ?= $(PREFIX)/share/man
>  
> -CFLAGS ?= -Werror -Wall -W
> +CFLAGS ?= -Werror -Wall -W -Werror
>  override CFLAGS += -I$(INCLUDEDIR)
>  LDLIBS = -lsepol -lselinux -L$(LIBDIR)
>  
> Index: trunk/policycoreutils/sestatus/Makefile
> ===================================================================
> --- trunk.orig/policycoreutils/sestatus/Makefile
> +++ trunk/policycoreutils/sestatus/Makefile
> @@ -5,7 +5,7 @@ MANDIR = $(PREFIX)/share/man
>  ETCDIR ?= $(DESTDIR)/etc
>  LIBDIR ?= ${PREFIX}/lib
>  
> -CFLAGS = -Werror -Wall -W
> +CFLAGS = -Werror -Wall -W -Werror
>  override CFLAGS += -I$(PREFIX)/include -D_FILE_OFFSET_BITS=64
>  LDLIBS = -lselinux -L$(LIBDIR)
>  
> Index: trunk/policycoreutils/setfiles/Makefile
> ===================================================================
> --- trunk.orig/policycoreutils/setfiles/Makefile
> +++ trunk/policycoreutils/setfiles/Makefile
> @@ -6,7 +6,7 @@ LIBDIR ?= $(PREFIX)/lib
>  
>  AUDITH = $(shell ls /usr/include/libaudit.h 2>/dev/null)
>  
> -CFLAGS = -Werror -Wall -W 
> +CFLAGS = -Werror -Wall -W  -Werror
>  override CFLAGS += -D_FILE_OFFSET_BITS=64 -I$(PREFIX)/include
>  LDLIBS = -lselinux -lsepol -L$(LIBDIR)
>  
> Index: trunk/policycoreutils/setsebool/Makefile
> ===================================================================
> --- trunk.orig/policycoreutils/setsebool/Makefile
> +++ trunk/policycoreutils/setsebool/Makefile
> @@ -5,7 +5,7 @@ SBINDIR ?= $(PREFIX)/sbin
>  MANDIR = $(PREFIX)/share/man
>  LIBDIR ?= ${PREFIX}/lib
>  
> -CFLAGS ?= -Werror -Wall -W
> +CFLAGS ?= -Werror -Wall -W -Werror
>  override CFLAGS += -I$(INCLUDEDIR)
>  LDLIBS = -lsepol -lselinux -lsemanage -L$(LIBDIR)
>  SETSEBOOL_OBJS = setsebool.o
> 
-- 
Stephen Smalley
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [patch 7/7] Use -Werror
  2008-01-07 18:06   ` Stephen Smalley
@ 2008-01-07 18:30     ` Joshua Brindle
  2008-01-07 18:50       ` Stephen Smalley
  0 siblings, 1 reply; 14+ messages in thread
From: Joshua Brindle @ 2008-01-07 18:30 UTC (permalink / raw)
  To: Stephen Smalley; +Cc: tmiller, selinux, method

Stephen Smalley wrote:
> On Thu, 2008-01-03 at 13:43 -0500, tmiller@tresys.com wrote:
>> plain text document attachment (Werror.patch)
>> Add -Werror to Makefiles
> 
> A bit overzealous though - some of them already had -Werror in CFLAGS.
> 
> Otherwise, looks fine.

Is there a good reason we have CFLAGS per Makefile instead of once at 
the top level? I use DEBUG=1 most of the time and everything builds fine 
with a common set.

> 
>> ---
>>  checkpolicy/Makefile                      |    2 +-
>>  libselinux/src/Makefile                   |    2 +-
>>  libsemanage/src/Makefile                  |    2 +-
>>  libsepol/src/Makefile                     |    2 +-
>>  policycoreutils/audit2why/Makefile        |    2 +-
>>  policycoreutils/load_policy/Makefile      |    2 +-
>>  policycoreutils/newrole/Makefile          |    2 +-
>>  policycoreutils/restorecond/Makefile      |    2 +-
>>  policycoreutils/run_init/Makefile         |    2 +-
>>  policycoreutils/secon/Makefile            |    2 +-
>>  policycoreutils/semodule/Makefile         |    2 +-
>>  policycoreutils/semodule_deps/Makefile    |    2 +-
>>  policycoreutils/semodule_expand/Makefile  |    2 +-
>>  policycoreutils/semodule_link/Makefile    |    2 +-
>>  policycoreutils/semodule_package/Makefile |    2 +-
>>  policycoreutils/sestatus/Makefile         |    2 +-
>>  policycoreutils/setfiles/Makefile         |    2 +-
>>  policycoreutils/setsebool/Makefile        |    2 +-
>>  18 files changed, 18 insertions(+), 18 deletions(-)
>>
>> Index: trunk/checkpolicy/Makefile
>> ===================================================================
>> --- trunk.orig/checkpolicy/Makefile
>> +++ trunk/checkpolicy/Makefile
>> @@ -10,7 +10,7 @@ TARGETS = checkpolicy checkmodule
>>  
>>  YACC = bison -y
>>  
>> -CFLAGS ?= -g -Wall -O2 -pipe -fno-strict-aliasing
>> +CFLAGS ?= -g -Wall -Werror -O2 -pipe -fno-strict-aliasing
>>  
>>  override CFLAGS += -I. -I${INCLUDEDIR}
>>  
>> Index: trunk/libselinux/src/Makefile
>> ===================================================================
>> --- trunk.orig/libselinux/src/Makefile
>> +++ trunk/libselinux/src/Makefile
>> @@ -32,7 +32,7 @@ SRCS= $(filter-out $(UNUSED_SRCS), $(fil
>>  
>>  OBJS= $(patsubst %.c,%.o,$(SRCS))
>>  LOBJS= $(patsubst %.c,%.lo,$(SRCS))
>> -CFLAGS ?= -Wall -W -Wundef -Wmissing-noreturn -Wmissing-format-attribute
>> +CFLAGS ?= -Wall -W -Wundef -Wmissing-noreturn -Wmissing-format-attribute -Werror
>>  override CFLAGS += -I../include -I$(INCLUDEDIR) -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 $(EMFLAGS)
>>  RANLIB=ranlib
>>  
>> Index: trunk/libsemanage/src/Makefile
>> ===================================================================
>> --- trunk.orig/libsemanage/src/Makefile
>> +++ trunk/libsemanage/src/Makefile
>> @@ -31,7 +31,7 @@ SWIGFILES=$(SWIGSO) semanage.py 
>>  LIBSO=$(TARGET).$(LIBVERSION)
>>  OBJS= $(patsubst %.c,%.o,$(filter-out $(SWIGCOUT),$(wildcard *.c))) conf-scan.o conf-parse.o
>>  LOBJS= $(patsubst %.c,%.lo,$(filter-out $(SWIGCOUT),$(wildcard *.c))) conf-scan.lo conf-parse.lo
>> -CFLAGS ?= -Wall -W -Wundef -Wmissing-noreturn -Wmissing-format-attribute -Wno-unused-parameter
>> +CFLAGS ?= -Wall -W Wundef -Wmissing-noreturn -Wmissing-format-attribute -Wno-unused-parameter
>>  
>>  override CFLAGS += -I../include -I$(INCLUDEDIR) -D_GNU_SOURCE 
>>  
>> Index: trunk/libsepol/src/Makefile
>> ===================================================================
>> --- trunk.orig/libsepol/src/Makefile
>> +++ trunk/libsepol/src/Makefile
>> @@ -10,7 +10,7 @@ TARGET=libsepol.so
>>  LIBSO=$(TARGET).$(LIBVERSION)
>>  OBJS= $(patsubst %.c,%.o,$(wildcard *.c))
>>  LOBJS= $(patsubst %.c,%.lo,$(wildcard *.c))
>> -CFLAGS ?= -Wall -W -Wundef -Wmissing-noreturn -Wmissing-format-attribute
>> +CFLAGS ?= -Wall -W -Wundef -Wmissing-noreturn -Wmissing-format-attribute -Werror
>>  override CFLAGS += -I. -I../include -D_GNU_SOURCE
>>  
>>  all: $(LIBA) $(LIBSO)
>> Index: trunk/policycoreutils/audit2why/Makefile
>> ===================================================================
>> --- trunk.orig/policycoreutils/audit2why/Makefile
>> +++ trunk/policycoreutils/audit2why/Makefile
>> @@ -7,7 +7,7 @@ LOCALEDIR ?= /usr/share/locale
>>  INCLUDEDIR ?= ${PREFIX}/include
>>  
>>
>> -CFLAGS ?= -Werror -Wall -W
>> +CFLAGS ?= -Werror -Wall -W -Werror
>>  override CFLAGS += -I$(INCLUDEDIR)
>>  LDLIBS = ${LIBDIR}/libsepol.a -lselinux -L$(LIBDIR)
>>  
>> Index: trunk/policycoreutils/load_policy/Makefile
>> ===================================================================
>> --- trunk.orig/policycoreutils/load_policy/Makefile
>> +++ trunk/policycoreutils/load_policy/Makefile
>> @@ -4,7 +4,7 @@ SBINDIR ?= $(PREFIX)/sbin
>>  MANDIR ?= $(PREFIX)/share/man
>>  LOCALEDIR ?= /usr/share/locale
>>  
>> -CFLAGS ?= -Werror -Wall -W
>> +CFLAGS ?= -Werror -Wall -W -Werror
>>  override CFLAGS += $(LDFLAGS) -I$(PREFIX)/include -DUSE_NLS -DLOCALEDIR="\"$(LOCALEDIR)\"" -DPACKAGE="\"policycoreutils\""
>>  LDLIBS += -lsepol -lselinux -L$(PREFIX)/lib
>>  
>> Index: trunk/policycoreutils/newrole/Makefile
>> ===================================================================
>> --- trunk.orig/policycoreutils/newrole/Makefile
>> +++ trunk/policycoreutils/newrole/Makefile
>> @@ -20,7 +20,7 @@ NAMESPACE_PRIV ?= n
>>  LSPP_PRIV ?= n
>>  VERSION = $(shell cat ../VERSION)
>>  
>> -CFLAGS ?= -Werror -Wall -W
>> +CFLAGS ?= -Werror -Wall -W -Werror
>>  EXTRA_OBJS =
>>  override CFLAGS += -DVERSION=\"$(VERSION)\" $(LDFLAGS) -I$(PREFIX)/include -DUSE_NLS -DLOCALEDIR="\"$(LOCALEDIR)\"" -DPACKAGE="\"policycoreutils\""
>>  LDLIBS += -lselinux -L$(PREFIX)/lib
>> Index: trunk/policycoreutils/restorecond/Makefile
>> ===================================================================
>> --- trunk.orig/policycoreutils/restorecond/Makefile
>> +++ trunk/policycoreutils/restorecond/Makefile
>> @@ -5,7 +5,7 @@ MANDIR = $(PREFIX)/share/man
>>  INITDIR = $(DESTDIR)/etc/rc.d/init.d
>>  SELINUXDIR = $(DESTDIR)/etc/selinux
>>  
>> -CFLAGS ?= -g -Werror -Wall -W
>> +CFLAGS ?= -g -Werror -Wall -W -Werror
>>  override CFLAGS += -I$(PREFIX)/include -D_FILE_OFFSET_BITS=64
>>  LDLIBS += -lselinux -L$(PREFIX)/lib
>>  
>> Index: trunk/policycoreutils/run_init/Makefile
>> ===================================================================
>> --- trunk.orig/policycoreutils/run_init/Makefile
>> +++ trunk/policycoreutils/run_init/Makefile
>> @@ -8,7 +8,7 @@ LOCALEDIR ?= /usr/share/locale
>>  PAMH = $(shell ls /usr/include/security/pam_appl.h 2>/dev/null)
>>  AUDITH = $(shell ls /usr/include/libaudit.h 2>/dev/null)
>>  
>> -CFLAGS ?= -Werror -Wall -W
>> +CFLAGS ?= -Werror -Wall -W -Werror
>>  override CFLAGS += -I$(PREFIX)/include -DUSE_NLS -DLOCALEDIR="\"$(LOCALEDIR)\"" -DPACKAGE="\"policycoreutils\""
>>  LDLIBS += -lselinux -L$(PREFIX)/lib
>>  ifeq (${PAMH}, /usr/include/security/pam_appl.h)
>> Index: trunk/policycoreutils/secon/Makefile
>> ===================================================================
>> --- trunk.orig/policycoreutils/secon/Makefile
>> +++ trunk/policycoreutils/secon/Makefile
>> @@ -5,7 +5,7 @@ BINDIR ?= $(PREFIX)/bin
>>  MANDIR ?= $(PREFIX)/share/man
>>  LIBDIR ?= ${PREFIX}/lib
>>  
>> -WARNS=-W -Wall -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Wno-format-zero-length -Wformat-nonliteral -Wformat-security -Wfloat-equal
>> +WARNS=-W -Wall -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Wno-format-zero-length -Wformat-nonliteral -Wformat-security -Wfloat-equal -Werror
>>  VERSION = $(shell cat ../VERSION)
>>  CFLAGS ?= $(WARNS) -O1
>>  override CFLAGS += -DVERSION=\"$(VERSION)\" -I$(INCLUDEDIR) 
>> Index: trunk/policycoreutils/semodule/Makefile
>> ===================================================================
>> --- trunk.orig/policycoreutils/semodule/Makefile
>> +++ trunk/policycoreutils/semodule/Makefile
>> @@ -5,7 +5,7 @@ SBINDIR ?= $(PREFIX)/sbin
>>  MANDIR = $(PREFIX)/share/man
>>  LIBDIR ?= ${PREFIX}/lib
>>  
>> -CFLAGS ?= -Werror -Wall -W
>> +CFLAGS ?= -Werror -Wall -W -Werror
>>  override CFLAGS += -I$(INCLUDEDIR)
>>  LDLIBS = -lsepol -lselinux -lsemanage -L$(LIBDIR)
>>  SEMODULE_OBJS = semodule.o
>> Index: trunk/policycoreutils/semodule_deps/Makefile
>> ===================================================================
>> --- trunk.orig/policycoreutils/semodule_deps/Makefile
>> +++ trunk/policycoreutils/semodule_deps/Makefile
>> @@ -5,7 +5,7 @@ BINDIR ?= $(PREFIX)/bin
>>  LIBDIR ?= ${PREFIX}/lib
>>  MANDIR ?= $(PREFIX)/share/man
>>  
>> -CFLAGS ?= -Werror -Wall -W
>> +CFLAGS ?= -Werror -Wall -W -Werror
>>  override CFLAGS += -I$(INCLUDEDIR)
>>  LDLIBS = $(LIBDIR)/libsepol.a
>>  
>> Index: trunk/policycoreutils/semodule_expand/Makefile
>> ===================================================================
>> --- trunk.orig/policycoreutils/semodule_expand/Makefile
>> +++ trunk/policycoreutils/semodule_expand/Makefile
>> @@ -5,7 +5,7 @@ BINDIR ?= $(PREFIX)/bin
>>  LIBDIR ?= ${PREFIX}/lib
>>  MANDIR ?= $(PREFIX)/share/man
>>  
>> -CFLAGS ?= -Werror -Wall -W
>> +CFLAGS ?= -Werror -Wall -W -Werror
>>  override CFLAGS += -I$(INCLUDEDIR)
>>  LDLIBS = -lsepol -lselinux -L$(LIBDIR)
>>  
>> Index: trunk/policycoreutils/semodule_link/Makefile
>> ===================================================================
>> --- trunk.orig/policycoreutils/semodule_link/Makefile
>> +++ trunk/policycoreutils/semodule_link/Makefile
>> @@ -5,7 +5,7 @@ BINDIR ?= $(PREFIX)/bin
>>  MANDIR ?= $(PREFIX)/share/man
>>  LIBDIR ?= ${PREFIX}/lib
>>  
>> -CFLAGS ?= -Werror -Wall -W
>> +CFLAGS ?= -Werror -Wall -W -Werror
>>  override CFLAGS += -I$(INCLUDEDIR)
>>  LDLIBS = -lsepol -lselinux -L$(LIBDIR)
>>  
>> Index: trunk/policycoreutils/semodule_package/Makefile
>> ===================================================================
>> --- trunk.orig/policycoreutils/semodule_package/Makefile
>> +++ trunk/policycoreutils/semodule_package/Makefile
>> @@ -5,7 +5,7 @@ BINDIR ?= $(PREFIX)/bin
>>  LIBDIR ?= ${PREFIX}/lib
>>  MANDIR ?= $(PREFIX)/share/man
>>  
>> -CFLAGS ?= -Werror -Wall -W
>> +CFLAGS ?= -Werror -Wall -W -Werror
>>  override CFLAGS += -I$(INCLUDEDIR)
>>  LDLIBS = -lsepol -lselinux -L$(LIBDIR)
>>  
>> Index: trunk/policycoreutils/sestatus/Makefile
>> ===================================================================
>> --- trunk.orig/policycoreutils/sestatus/Makefile
>> +++ trunk/policycoreutils/sestatus/Makefile
>> @@ -5,7 +5,7 @@ MANDIR = $(PREFIX)/share/man
>>  ETCDIR ?= $(DESTDIR)/etc
>>  LIBDIR ?= ${PREFIX}/lib
>>  
>> -CFLAGS = -Werror -Wall -W
>> +CFLAGS = -Werror -Wall -W -Werror
>>  override CFLAGS += -I$(PREFIX)/include -D_FILE_OFFSET_BITS=64
>>  LDLIBS = -lselinux -L$(LIBDIR)
>>  
>> Index: trunk/policycoreutils/setfiles/Makefile
>> ===================================================================
>> --- trunk.orig/policycoreutils/setfiles/Makefile
>> +++ trunk/policycoreutils/setfiles/Makefile
>> @@ -6,7 +6,7 @@ LIBDIR ?= $(PREFIX)/lib
>>  
>>  AUDITH = $(shell ls /usr/include/libaudit.h 2>/dev/null)
>>  
>> -CFLAGS = -Werror -Wall -W 
>> +CFLAGS = -Werror -Wall -W  -Werror
>>  override CFLAGS += -D_FILE_OFFSET_BITS=64 -I$(PREFIX)/include
>>  LDLIBS = -lselinux -lsepol -L$(LIBDIR)
>>  
>> Index: trunk/policycoreutils/setsebool/Makefile
>> ===================================================================
>> --- trunk.orig/policycoreutils/setsebool/Makefile
>> +++ trunk/policycoreutils/setsebool/Makefile
>> @@ -5,7 +5,7 @@ SBINDIR ?= $(PREFIX)/sbin
>>  MANDIR = $(PREFIX)/share/man
>>  LIBDIR ?= ${PREFIX}/lib
>>  
>> -CFLAGS ?= -Werror -Wall -W
>> +CFLAGS ?= -Werror -Wall -W -Werror
>>  override CFLAGS += -I$(INCLUDEDIR)
>>  LDLIBS = -lsepol -lselinux -lsemanage -L$(LIBDIR)
>>  SETSEBOOL_OBJS = setsebool.o
>>



--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [patch 7/7] Use -Werror
  2008-01-07 18:30     ` Joshua Brindle
@ 2008-01-07 18:50       ` Stephen Smalley
  0 siblings, 0 replies; 14+ messages in thread
From: Stephen Smalley @ 2008-01-07 18:50 UTC (permalink / raw)
  To: Joshua Brindle; +Cc: tmiller, selinux, method


On Mon, 2008-01-07 at 13:30 -0500, Joshua Brindle wrote:
> Stephen Smalley wrote:
> > On Thu, 2008-01-03 at 13:43 -0500, tmiller@tresys.com wrote:
> >> plain text document attachment (Werror.patch)
> >> Add -Werror to Makefiles
> > 
> > A bit overzealous though - some of them already had -Werror in CFLAGS.
> > 
> > Otherwise, looks fine.
> 
> Is there a good reason we have CFLAGS per Makefile instead of once at 
> the top level? I use DEBUG=1 most of the time and everything builds fine 
> with a common set.

Mostly because the components are released as individual tar balls and
packages, w/o the top level Makefile altogether.

Also need to make sure that -Werror gets included by make DEBUG=1 then.

> > 
> >> ---
> >>  checkpolicy/Makefile                      |    2 +-
> >>  libselinux/src/Makefile                   |    2 +-
> >>  libsemanage/src/Makefile                  |    2 +-
> >>  libsepol/src/Makefile                     |    2 +-
> >>  policycoreutils/audit2why/Makefile        |    2 +-
> >>  policycoreutils/load_policy/Makefile      |    2 +-
> >>  policycoreutils/newrole/Makefile          |    2 +-
> >>  policycoreutils/restorecond/Makefile      |    2 +-
> >>  policycoreutils/run_init/Makefile         |    2 +-
> >>  policycoreutils/secon/Makefile            |    2 +-
> >>  policycoreutils/semodule/Makefile         |    2 +-
> >>  policycoreutils/semodule_deps/Makefile    |    2 +-
> >>  policycoreutils/semodule_expand/Makefile  |    2 +-
> >>  policycoreutils/semodule_link/Makefile    |    2 +-
> >>  policycoreutils/semodule_package/Makefile |    2 +-
> >>  policycoreutils/sestatus/Makefile         |    2 +-
> >>  policycoreutils/setfiles/Makefile         |    2 +-
> >>  policycoreutils/setsebool/Makefile        |    2 +-
> >>  18 files changed, 18 insertions(+), 18 deletions(-)
> >>
> >> Index: trunk/checkpolicy/Makefile
> >> ===================================================================
> >> --- trunk.orig/checkpolicy/Makefile
> >> +++ trunk/checkpolicy/Makefile
> >> @@ -10,7 +10,7 @@ TARGETS = checkpolicy checkmodule
> >>  
> >>  YACC = bison -y
> >>  
> >> -CFLAGS ?= -g -Wall -O2 -pipe -fno-strict-aliasing
> >> +CFLAGS ?= -g -Wall -Werror -O2 -pipe -fno-strict-aliasing
> >>  
> >>  override CFLAGS += -I. -I${INCLUDEDIR}
> >>  
> >> Index: trunk/libselinux/src/Makefile
> >> ===================================================================
> >> --- trunk.orig/libselinux/src/Makefile
> >> +++ trunk/libselinux/src/Makefile
> >> @@ -32,7 +32,7 @@ SRCS= $(filter-out $(UNUSED_SRCS), $(fil
> >>  
> >>  OBJS= $(patsubst %.c,%.o,$(SRCS))
> >>  LOBJS= $(patsubst %.c,%.lo,$(SRCS))
> >> -CFLAGS ?= -Wall -W -Wundef -Wmissing-noreturn -Wmissing-format-attribute
> >> +CFLAGS ?= -Wall -W -Wundef -Wmissing-noreturn -Wmissing-format-attribute -Werror
> >>  override CFLAGS += -I../include -I$(INCLUDEDIR) -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 $(EMFLAGS)
> >>  RANLIB=ranlib
> >>  
> >> Index: trunk/libsemanage/src/Makefile
> >> ===================================================================
> >> --- trunk.orig/libsemanage/src/Makefile
> >> +++ trunk/libsemanage/src/Makefile
> >> @@ -31,7 +31,7 @@ SWIGFILES=$(SWIGSO) semanage.py 
> >>  LIBSO=$(TARGET).$(LIBVERSION)
> >>  OBJS= $(patsubst %.c,%.o,$(filter-out $(SWIGCOUT),$(wildcard *.c))) conf-scan.o conf-parse.o
> >>  LOBJS= $(patsubst %.c,%.lo,$(filter-out $(SWIGCOUT),$(wildcard *.c))) conf-scan.lo conf-parse.lo
> >> -CFLAGS ?= -Wall -W -Wundef -Wmissing-noreturn -Wmissing-format-attribute -Wno-unused-parameter
> >> +CFLAGS ?= -Wall -W Wundef -Wmissing-noreturn -Wmissing-format-attribute -Wno-unused-parameter
> >>  
> >>  override CFLAGS += -I../include -I$(INCLUDEDIR) -D_GNU_SOURCE 
> >>  
> >> Index: trunk/libsepol/src/Makefile
> >> ===================================================================
> >> --- trunk.orig/libsepol/src/Makefile
> >> +++ trunk/libsepol/src/Makefile
> >> @@ -10,7 +10,7 @@ TARGET=libsepol.so
> >>  LIBSO=$(TARGET).$(LIBVERSION)
> >>  OBJS= $(patsubst %.c,%.o,$(wildcard *.c))
> >>  LOBJS= $(patsubst %.c,%.lo,$(wildcard *.c))
> >> -CFLAGS ?= -Wall -W -Wundef -Wmissing-noreturn -Wmissing-format-attribute
> >> +CFLAGS ?= -Wall -W -Wundef -Wmissing-noreturn -Wmissing-format-attribute -Werror
> >>  override CFLAGS += -I. -I../include -D_GNU_SOURCE
> >>  
> >>  all: $(LIBA) $(LIBSO)
> >> Index: trunk/policycoreutils/audit2why/Makefile
> >> ===================================================================
> >> --- trunk.orig/policycoreutils/audit2why/Makefile
> >> +++ trunk/policycoreutils/audit2why/Makefile
> >> @@ -7,7 +7,7 @@ LOCALEDIR ?= /usr/share/locale
> >>  INCLUDEDIR ?= ${PREFIX}/include
> >>  
> >>
> >> -CFLAGS ?= -Werror -Wall -W
> >> +CFLAGS ?= -Werror -Wall -W -Werror
> >>  override CFLAGS += -I$(INCLUDEDIR)
> >>  LDLIBS = ${LIBDIR}/libsepol.a -lselinux -L$(LIBDIR)
> >>  
> >> Index: trunk/policycoreutils/load_policy/Makefile
> >> ===================================================================
> >> --- trunk.orig/policycoreutils/load_policy/Makefile
> >> +++ trunk/policycoreutils/load_policy/Makefile
> >> @@ -4,7 +4,7 @@ SBINDIR ?= $(PREFIX)/sbin
> >>  MANDIR ?= $(PREFIX)/share/man
> >>  LOCALEDIR ?= /usr/share/locale
> >>  
> >> -CFLAGS ?= -Werror -Wall -W
> >> +CFLAGS ?= -Werror -Wall -W -Werror
> >>  override CFLAGS += $(LDFLAGS) -I$(PREFIX)/include -DUSE_NLS -DLOCALEDIR="\"$(LOCALEDIR)\"" -DPACKAGE="\"policycoreutils\""
> >>  LDLIBS += -lsepol -lselinux -L$(PREFIX)/lib
> >>  
> >> Index: trunk/policycoreutils/newrole/Makefile
> >> ===================================================================
> >> --- trunk.orig/policycoreutils/newrole/Makefile
> >> +++ trunk/policycoreutils/newrole/Makefile
> >> @@ -20,7 +20,7 @@ NAMESPACE_PRIV ?= n
> >>  LSPP_PRIV ?= n
> >>  VERSION = $(shell cat ../VERSION)
> >>  
> >> -CFLAGS ?= -Werror -Wall -W
> >> +CFLAGS ?= -Werror -Wall -W -Werror
> >>  EXTRA_OBJS =
> >>  override CFLAGS += -DVERSION=\"$(VERSION)\" $(LDFLAGS) -I$(PREFIX)/include -DUSE_NLS -DLOCALEDIR="\"$(LOCALEDIR)\"" -DPACKAGE="\"policycoreutils\""
> >>  LDLIBS += -lselinux -L$(PREFIX)/lib
> >> Index: trunk/policycoreutils/restorecond/Makefile
> >> ===================================================================
> >> --- trunk.orig/policycoreutils/restorecond/Makefile
> >> +++ trunk/policycoreutils/restorecond/Makefile
> >> @@ -5,7 +5,7 @@ MANDIR = $(PREFIX)/share/man
> >>  INITDIR = $(DESTDIR)/etc/rc.d/init.d
> >>  SELINUXDIR = $(DESTDIR)/etc/selinux
> >>  
> >> -CFLAGS ?= -g -Werror -Wall -W
> >> +CFLAGS ?= -g -Werror -Wall -W -Werror
> >>  override CFLAGS += -I$(PREFIX)/include -D_FILE_OFFSET_BITS=64
> >>  LDLIBS += -lselinux -L$(PREFIX)/lib
> >>  
> >> Index: trunk/policycoreutils/run_init/Makefile
> >> ===================================================================
> >> --- trunk.orig/policycoreutils/run_init/Makefile
> >> +++ trunk/policycoreutils/run_init/Makefile
> >> @@ -8,7 +8,7 @@ LOCALEDIR ?= /usr/share/locale
> >>  PAMH = $(shell ls /usr/include/security/pam_appl.h 2>/dev/null)
> >>  AUDITH = $(shell ls /usr/include/libaudit.h 2>/dev/null)
> >>  
> >> -CFLAGS ?= -Werror -Wall -W
> >> +CFLAGS ?= -Werror -Wall -W -Werror
> >>  override CFLAGS += -I$(PREFIX)/include -DUSE_NLS -DLOCALEDIR="\"$(LOCALEDIR)\"" -DPACKAGE="\"policycoreutils\""
> >>  LDLIBS += -lselinux -L$(PREFIX)/lib
> >>  ifeq (${PAMH}, /usr/include/security/pam_appl.h)
> >> Index: trunk/policycoreutils/secon/Makefile
> >> ===================================================================
> >> --- trunk.orig/policycoreutils/secon/Makefile
> >> +++ trunk/policycoreutils/secon/Makefile
> >> @@ -5,7 +5,7 @@ BINDIR ?= $(PREFIX)/bin
> >>  MANDIR ?= $(PREFIX)/share/man
> >>  LIBDIR ?= ${PREFIX}/lib
> >>  
> >> -WARNS=-W -Wall -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Wno-format-zero-length -Wformat-nonliteral -Wformat-security -Wfloat-equal
> >> +WARNS=-W -Wall -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Wno-format-zero-length -Wformat-nonliteral -Wformat-security -Wfloat-equal -Werror
> >>  VERSION = $(shell cat ../VERSION)
> >>  CFLAGS ?= $(WARNS) -O1
> >>  override CFLAGS += -DVERSION=\"$(VERSION)\" -I$(INCLUDEDIR) 
> >> Index: trunk/policycoreutils/semodule/Makefile
> >> ===================================================================
> >> --- trunk.orig/policycoreutils/semodule/Makefile
> >> +++ trunk/policycoreutils/semodule/Makefile
> >> @@ -5,7 +5,7 @@ SBINDIR ?= $(PREFIX)/sbin
> >>  MANDIR = $(PREFIX)/share/man
> >>  LIBDIR ?= ${PREFIX}/lib
> >>  
> >> -CFLAGS ?= -Werror -Wall -W
> >> +CFLAGS ?= -Werror -Wall -W -Werror
> >>  override CFLAGS += -I$(INCLUDEDIR)
> >>  LDLIBS = -lsepol -lselinux -lsemanage -L$(LIBDIR)
> >>  SEMODULE_OBJS = semodule.o
> >> Index: trunk/policycoreutils/semodule_deps/Makefile
> >> ===================================================================
> >> --- trunk.orig/policycoreutils/semodule_deps/Makefile
> >> +++ trunk/policycoreutils/semodule_deps/Makefile
> >> @@ -5,7 +5,7 @@ BINDIR ?= $(PREFIX)/bin
> >>  LIBDIR ?= ${PREFIX}/lib
> >>  MANDIR ?= $(PREFIX)/share/man
> >>  
> >> -CFLAGS ?= -Werror -Wall -W
> >> +CFLAGS ?= -Werror -Wall -W -Werror
> >>  override CFLAGS += -I$(INCLUDEDIR)
> >>  LDLIBS = $(LIBDIR)/libsepol.a
> >>  
> >> Index: trunk/policycoreutils/semodule_expand/Makefile
> >> ===================================================================
> >> --- trunk.orig/policycoreutils/semodule_expand/Makefile
> >> +++ trunk/policycoreutils/semodule_expand/Makefile
> >> @@ -5,7 +5,7 @@ BINDIR ?= $(PREFIX)/bin
> >>  LIBDIR ?= ${PREFIX}/lib
> >>  MANDIR ?= $(PREFIX)/share/man
> >>  
> >> -CFLAGS ?= -Werror -Wall -W
> >> +CFLAGS ?= -Werror -Wall -W -Werror
> >>  override CFLAGS += -I$(INCLUDEDIR)
> >>  LDLIBS = -lsepol -lselinux -L$(LIBDIR)
> >>  
> >> Index: trunk/policycoreutils/semodule_link/Makefile
> >> ===================================================================
> >> --- trunk.orig/policycoreutils/semodule_link/Makefile
> >> +++ trunk/policycoreutils/semodule_link/Makefile
> >> @@ -5,7 +5,7 @@ BINDIR ?= $(PREFIX)/bin
> >>  MANDIR ?= $(PREFIX)/share/man
> >>  LIBDIR ?= ${PREFIX}/lib
> >>  
> >> -CFLAGS ?= -Werror -Wall -W
> >> +CFLAGS ?= -Werror -Wall -W -Werror
> >>  override CFLAGS += -I$(INCLUDEDIR)
> >>  LDLIBS = -lsepol -lselinux -L$(LIBDIR)
> >>  
> >> Index: trunk/policycoreutils/semodule_package/Makefile
> >> ===================================================================
> >> --- trunk.orig/policycoreutils/semodule_package/Makefile
> >> +++ trunk/policycoreutils/semodule_package/Makefile
> >> @@ -5,7 +5,7 @@ BINDIR ?= $(PREFIX)/bin
> >>  LIBDIR ?= ${PREFIX}/lib
> >>  MANDIR ?= $(PREFIX)/share/man
> >>  
> >> -CFLAGS ?= -Werror -Wall -W
> >> +CFLAGS ?= -Werror -Wall -W -Werror
> >>  override CFLAGS += -I$(INCLUDEDIR)
> >>  LDLIBS = -lsepol -lselinux -L$(LIBDIR)
> >>  
> >> Index: trunk/policycoreutils/sestatus/Makefile
> >> ===================================================================
> >> --- trunk.orig/policycoreutils/sestatus/Makefile
> >> +++ trunk/policycoreutils/sestatus/Makefile
> >> @@ -5,7 +5,7 @@ MANDIR = $(PREFIX)/share/man
> >>  ETCDIR ?= $(DESTDIR)/etc
> >>  LIBDIR ?= ${PREFIX}/lib
> >>  
> >> -CFLAGS = -Werror -Wall -W
> >> +CFLAGS = -Werror -Wall -W -Werror
> >>  override CFLAGS += -I$(PREFIX)/include -D_FILE_OFFSET_BITS=64
> >>  LDLIBS = -lselinux -L$(LIBDIR)
> >>  
> >> Index: trunk/policycoreutils/setfiles/Makefile
> >> ===================================================================
> >> --- trunk.orig/policycoreutils/setfiles/Makefile
> >> +++ trunk/policycoreutils/setfiles/Makefile
> >> @@ -6,7 +6,7 @@ LIBDIR ?= $(PREFIX)/lib
> >>  
> >>  AUDITH = $(shell ls /usr/include/libaudit.h 2>/dev/null)
> >>  
> >> -CFLAGS = -Werror -Wall -W 
> >> +CFLAGS = -Werror -Wall -W  -Werror
> >>  override CFLAGS += -D_FILE_OFFSET_BITS=64 -I$(PREFIX)/include
> >>  LDLIBS = -lselinux -lsepol -L$(LIBDIR)
> >>  
> >> Index: trunk/policycoreutils/setsebool/Makefile
> >> ===================================================================
> >> --- trunk.orig/policycoreutils/setsebool/Makefile
> >> +++ trunk/policycoreutils/setsebool/Makefile
> >> @@ -5,7 +5,7 @@ SBINDIR ?= $(PREFIX)/sbin
> >>  MANDIR = $(PREFIX)/share/man
> >>  LIBDIR ?= ${PREFIX}/lib
> >>  
> >> -CFLAGS ?= -Werror -Wall -W
> >> +CFLAGS ?= -Werror -Wall -W -Werror
> >>  override CFLAGS += -I$(INCLUDEDIR)
> >>  LDLIBS = -lsepol -lselinux -lsemanage -L$(LIBDIR)
> >>  SETSEBOOL_OBJS = setsebool.o
> >>
> 
-- 
Stephen Smalley
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [patch 7/7] Use -Werror
  2008-01-09 14:19   ` Todd Miller
@ 2008-01-09 14:24     ` Joshua Brindle
  2008-01-09 15:33       ` Todd Miller
  0 siblings, 1 reply; 14+ messages in thread
From: Joshua Brindle @ 2008-01-09 14:24 UTC (permalink / raw)
  To: Todd Miller; +Cc: Stephen Smalley, selinux

Todd Miller wrote:
> Stephen Smalley wrote:
>   
>> On Mon, 2008-01-07 at 15:47 -0500, Todd C. Miller wrote:
>>     
>>> Stephen Smalley wrote:
>>>
>>>       
>>>> A bit overzealous though - some of them already had -Werror in
>>>> CFLAGS. Also need to make sure that -Werror gets included by make
>>>> DEBUG=1. 
>>>>         
>>> Updated patch without the duplicated -Werror and adds it for
>>> the DEBUG=1 cases.
>>>       
>> This breaks make pywrap in libselinux, or install-pywrap from top.
>>     
>
> I always forget that pywrap is not built by the default target.
> I'll commit a fix to filter out -Werror for pywrap.
>   

Also with DEBUG=1 there is another warning in newrole.c about a shadowed 
var.



--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: [patch 7/7] Use -Werror
  2008-01-09 14:24     ` Joshua Brindle
@ 2008-01-09 15:33       ` Todd Miller
  0 siblings, 0 replies; 14+ messages in thread
From: Todd Miller @ 2008-01-09 15:33 UTC (permalink / raw)
  To: Joshua Brindle; +Cc: Stephen Smalley, selinux

Joshua Brindle wrote:
 
> Also with DEBUG=1 there is another warning in newrole.c about a
> shadowed var.

I didn't have pam-devel installed on my build machine so this wasn't
showing up for me.  I've fixed the shadowed declaration now.

 - todd


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: [patch 0/7] quiet gcc warnings
  2008-01-03 18:43 [patch 0/7] quiet gcc warnings tmiller
                   ` (6 preceding siblings ...)
  2008-01-03 18:43 ` [patch 7/7] Use -Werror tmiller
@ 2008-01-09 18:47 ` Todd Miller
  7 siblings, 0 replies; 14+ messages in thread
From: Todd Miller @ 2008-01-09 18:47 UTC (permalink / raw)
  To: selinux; +Cc: method, sds

tmiller@tresys.com wrote:
> These patches fix a number of gcc warnings in the selinux userland
> build process.  They allow everything but libsemanage to build with
> -Werror.  The only thing in the way of libsemanage using -Werror is
> the flex-generated scanner.  We could just drop a few of the -W flags
> for libsemanage (like -Wundef) to make it pass.

Merged into the stable and policyrep branches.

 - todd


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2008-01-09 18:47 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-03 18:43 [patch 0/7] quiet gcc warnings tmiller
2008-01-03 18:43 ` [patch 1/7] quiet checkpolicy warnings tmiller
2008-01-03 18:43 ` [patch 2/7] quiet libsepol qualifier warnings tmiller
2008-01-03 18:43 ` [patch 3/7] quiet getdefaultcon warning tmiller
2008-01-03 18:43 ` [patch 4/7] quiet libsemanage scanner warnings tmiller
2008-01-03 18:43 ` [patch 5/7] quiet libsepol uninitialized variable warnings tmiller
2008-01-03 18:43 ` [patch 6/7] quiet policycoreutils warnings tmiller
2008-01-03 18:43 ` [patch 7/7] Use -Werror tmiller
2008-01-07 18:06   ` Stephen Smalley
2008-01-07 18:30     ` Joshua Brindle
2008-01-07 18:50       ` Stephen Smalley
2008-01-09 18:47 ` [patch 0/7] quiet gcc warnings Todd Miller
  -- strict thread matches above, loose matches on Subject: below --
2008-01-07 20:47 Re: [patch 7/7] Use -Werror Todd C. Miller
2008-01-09 13:09 ` Stephen Smalley
2008-01-09 14:19   ` Todd Miller
2008-01-09 14:24     ` Joshua Brindle
2008-01-09 15:33       ` Todd Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.