All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Fix warning messages generated by GCC 4.6
@ 2010-07-06 22:23 ` Justin P. Mattock
  0 siblings, 0 replies; 11+ messages in thread
From: Justin P. Mattock @ 2010-07-06 22:23 UTC (permalink / raw)
  To: selinux; +Cc: refpolicy




Here is a set of patches that get me up and running without any
errors, nor warnings from GCC(or atleast most of them). 
Seems with the latest 4.6 there's more enforcement envolved
with these i.e. one machine with GCC 4.4 compiles fine,
and on the other hand the later GCC I get errors(-Werror)
and stoppage etc...

In any case if you like what you see let me know, if not let
me know so that I can make the appropriate change's to fix 
this and make things good excetra..

Justin P. Mattock

--
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] 11+ messages in thread

* [refpolicy] [PATCH 0/3] Fix warning messages generated by GCC 4.6
@ 2010-07-06 22:23 ` Justin P. Mattock
  0 siblings, 0 replies; 11+ messages in thread
From: Justin P. Mattock @ 2010-07-06 22:23 UTC (permalink / raw)
  To: refpolicy




Here is a set of patches that get me up and running without any
errors, nor warnings from GCC(or atleast most of them). 
Seems with the latest 4.6 there's more enforcement envolved
with these i.e. one machine with GCC 4.4 compiles fine,
and on the other hand the later GCC I get errors(-Werror)
and stoppage etc...

In any case if you like what you see let me know, if not let
me know so that I can make the appropriate change's to fix 
this and make things good excetra..

Justin P. Mattock

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

* [PATCH 1/3]checkpolicy Fix error: variable 'newattr' set but not used(and others as well)
  2010-07-06 22:23 ` [refpolicy] " Justin P. Mattock
@ 2010-07-06 22:23   ` Justin P. Mattock
  -1 siblings, 0 replies; 11+ messages in thread
From: Justin P. Mattock @ 2010-07-06 22:23 UTC (permalink / raw)
  To: selinux; +Cc: refpolicy, Justin P. Mattock

The below patch fixes some warning messages Im receiving
with GCC:(in this case some are erros due to -Werror)
policy_define.c: In function 'define_type':
policy_define.c:1216:6: error: variable 'newattr' set but not used
cc1: all warnings being treated as errors

Signed-off-by: Justin P. Mattock <justinmattock@gmail.com>

---
 checkpolicy/policy_define.c |    3 ---
 checkpolicy/test/dismod.c   |    2 --
 2 files changed, 0 insertions(+), 5 deletions(-)

diff --git a/checkpolicy/policy_define.c b/checkpolicy/policy_define.c
index a064307..82ab44c 100644
--- a/checkpolicy/policy_define.c
+++ b/checkpolicy/policy_define.c
@@ -1213,7 +1213,6 @@ int define_type(int alias)
 {
 	char *id;
 	type_datum_t *datum, *attr;
-	int newattr = 0;
 
 	if (pass == 2) {
 		/*
@@ -1266,8 +1265,6 @@ int define_type(int alias)
 			/* treat it as a fatal error */
 			yyerror2("attribute %s is not declared", id);
 			return -1;
-		} else {
-			newattr = 0;
 		}
 
 		if (attr->flavor != TYPE_ATTRIB) {
diff --git a/checkpolicy/test/dismod.c b/checkpolicy/test/dismod.c
index 705f1cb..4d31597 100644
--- a/checkpolicy/test/dismod.c
+++ b/checkpolicy/test/dismod.c
@@ -474,11 +474,9 @@ void display_role_allow(role_allow_rule_t * ra, policydb_t * p, FILE * fp)
 
 int role_display_callback(hashtab_key_t key, hashtab_datum_t datum, void *data)
 {
-	char *id;
 	role_datum_t *role;
 	FILE *fp;
 
-	id = key;
 	role = (role_datum_t *) datum;
 	fp = (FILE *) data;
 
-- 
1.7.1.rc1.21.gf3bd6


--
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 related	[flat|nested] 11+ messages in thread

* [refpolicy] [PATCH 1/3]checkpolicy Fix error: variable 'newattr' set but not used(and others as well)
@ 2010-07-06 22:23   ` Justin P. Mattock
  0 siblings, 0 replies; 11+ messages in thread
From: Justin P. Mattock @ 2010-07-06 22:23 UTC (permalink / raw)
  To: refpolicy

The below patch fixes some warning messages Im receiving
with GCC:(in this case some are erros due to -Werror)
policy_define.c: In function 'define_type':
policy_define.c:1216:6: error: variable 'newattr' set but not used
cc1: all warnings being treated as errors

Signed-off-by: Justin P. Mattock <justinmattock@gmail.com>

---
 checkpolicy/policy_define.c |    3 ---
 checkpolicy/test/dismod.c   |    2 --
 2 files changed, 0 insertions(+), 5 deletions(-)

diff --git a/checkpolicy/policy_define.c b/checkpolicy/policy_define.c
index a064307..82ab44c 100644
--- a/checkpolicy/policy_define.c
+++ b/checkpolicy/policy_define.c
@@ -1213,7 +1213,6 @@ int define_type(int alias)
 {
 	char *id;
 	type_datum_t *datum, *attr;
-	int newattr = 0;
 
 	if (pass == 2) {
 		/*
@@ -1266,8 +1265,6 @@ int define_type(int alias)
 			/* treat it as a fatal error */
 			yyerror2("attribute %s is not declared", id);
 			return -1;
-		} else {
-			newattr = 0;
 		}
 
 		if (attr->flavor != TYPE_ATTRIB) {
diff --git a/checkpolicy/test/dismod.c b/checkpolicy/test/dismod.c
index 705f1cb..4d31597 100644
--- a/checkpolicy/test/dismod.c
+++ b/checkpolicy/test/dismod.c
@@ -474,11 +474,9 @@ void display_role_allow(role_allow_rule_t * ra, policydb_t * p, FILE * fp)
 
 int role_display_callback(hashtab_key_t key, hashtab_datum_t datum, void *data)
 {
-	char *id;
 	role_datum_t *role;
 	FILE *fp;
 
-	id = key;
 	role = (role_datum_t *) datum;
 	fp = (FILE *) data;
 
-- 
1.7.1.rc1.21.gf3bd6

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

* [PATCH 2/3]libsepol
  2010-07-06 22:23 ` [refpolicy] " Justin P. Mattock
@ 2010-07-06 22:23   ` Justin P. Mattock
  -1 siblings, 0 replies; 11+ messages in thread
From: Justin P. Mattock @ 2010-07-06 22:23 UTC (permalink / raw)
  To: selinux; +Cc: refpolicy, Justin P. Mattock

Going through these warning messages Im getting:
(example 1 of many)
booleans.c: In function 'sepol_bool_count':
booleans.c:106:39: error: parameter 'handle' set but not used
cc1: all warnings being treated as errors

seems most of these go to NULL; Which tells me that these are here for
future use and/or need to be there for some other reason.
The biggest problem I have is Im getting errors out of these as opposed
to just a warning(-Werror) so marking the variable with a GCC
__attribute__ ((unused)) gets things going. 
 
Signed-off-by: Justin P. Mattock <justinmattock@gmail.com>

---
 libsepol/src/booleans.c   |    2 +-
 libsepol/src/debug.c      |    2 +-
 libsepol/src/interfaces.c |    4 ++--
 libsepol/src/nodes.c      |    2 +-
 libsepol/src/policydb.c   |    4 +---
 libsepol/src/ports.c      |    2 +-
 libsepol/src/roles.c      |    2 +-
 libsepol/src/services.c   |    2 --
 libsepol/src/users.c      |    4 ++--
 9 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/libsepol/src/booleans.c b/libsepol/src/booleans.c
index 7f37c8b..03f8c98 100644
--- a/libsepol/src/booleans.c
+++ b/libsepol/src/booleans.c
@@ -103,7 +103,7 @@ int sepol_bool_set(sepol_handle_t * handle,
 	return STATUS_ERR;
 }
 
-int sepol_bool_count(sepol_handle_t * handle,
+int sepol_bool_count(sepol_handle_t * handle __attribute__ ((unused)),
 		     const sepol_policydb_t * p, unsigned int *response)
 {
 
diff --git a/libsepol/src/debug.c b/libsepol/src/debug.c
index 552b7d7..51918fd 100644
--- a/libsepol/src/debug.c
+++ b/libsepol/src/debug.c
@@ -41,7 +41,7 @@ hidden_def(sepol_msg_get_fname)
 #ifdef __GNUC__
     __attribute__ ((format(printf, 3, 4)))
 #endif
-void hidden sepol_msg_default_handler(void *varg,
+void hidden sepol_msg_default_handler(void *varg __attribute__ ((unused)),
 				      sepol_handle_t * handle,
 				      const char *fmt, ...)
 {
diff --git a/libsepol/src/interfaces.c b/libsepol/src/interfaces.c
index fd4a001..b82d0f3 100644
--- a/libsepol/src/interfaces.c
+++ b/libsepol/src/interfaces.c
@@ -106,7 +106,7 @@ static int iface_to_record(sepol_handle_t * handle,
 }
 
 /* Check if an interface exists */
-int sepol_iface_exists(sepol_handle_t * handle,
+int sepol_iface_exists(sepol_handle_t * handle __attribute__ ((unused)),
 		       const sepol_policydb_t * p,
 		       const sepol_iface_key_t * key, int *response)
 {
@@ -216,7 +216,7 @@ int sepol_iface_modify(sepol_handle_t * handle,
 }
 
 /* Return the number of interfaces */
-extern int sepol_iface_count(sepol_handle_t * handle,
+extern int sepol_iface_count(sepol_handle_t * handle __attribute__ ((unused)),
 			     const sepol_policydb_t * p, unsigned int *response)
 {
 
diff --git a/libsepol/src/nodes.c b/libsepol/src/nodes.c
index ba2934d..ebf5f1d 100644
--- a/libsepol/src/nodes.c
+++ b/libsepol/src/nodes.c
@@ -144,7 +144,7 @@ static int node_to_record(sepol_handle_t * handle,
 }
 
 /* Return the number of nodes */
-extern int sepol_node_count(sepol_handle_t * handle,
+extern int sepol_node_count(sepol_handle_t * handle __attribute__ ((unused)),
 			    const sepol_policydb_t * p, unsigned int *response)
 {
 
diff --git a/libsepol/src/policydb.c b/libsepol/src/policydb.c
index dae05d3..5c0081f 100644
--- a/libsepol/src/policydb.c
+++ b/libsepol/src/policydb.c
@@ -3234,7 +3234,7 @@ int policydb_read(policydb_t * p, struct policy_file *fp, unsigned verbose)
 {
 
 	unsigned int i, j, r_policyvers;
-	uint32_t buf[5], config;
+	uint32_t buf[5];
 	size_t len, nprim, nel;
 	char *policydb_str;
 	struct policydb_compat_info *info;
@@ -3242,8 +3242,6 @@ int policydb_read(policydb_t * p, struct policy_file *fp, unsigned verbose)
 	ebitmap_node_t *tnode;
 	int rc;
 
-	config = 0;
-
 	/* Read the magic number and string length. */
 	rc = next_entry(buf, fp, sizeof(uint32_t) * 2);
 	if (rc < 0)
diff --git a/libsepol/src/ports.c b/libsepol/src/ports.c
index 06a0743..cbf2a0b 100644
--- a/libsepol/src/ports.c
+++ b/libsepol/src/ports.c
@@ -140,7 +140,7 @@ static int port_to_record(sepol_handle_t * handle,
 }
 
 /* Return the number of ports */
-extern int sepol_port_count(sepol_handle_t * handle,
+extern int sepol_port_count(sepol_handle_t * handle __attribute__ ((unused)),
 			    const sepol_policydb_t * p, unsigned int *response)
 {
 
diff --git a/libsepol/src/roles.c b/libsepol/src/roles.c
index 47aed15..419a3b2 100644
--- a/libsepol/src/roles.c
+++ b/libsepol/src/roles.c
@@ -8,7 +8,7 @@
 #include "handle.h"
 
 /* Check if a role exists */
-int sepol_role_exists(sepol_handle_t * handle,
+int sepol_role_exists(sepol_handle_t * handle __attribute__ ((unused)),
 		      sepol_policydb_t * p, const char *role, int *response)
 {
 
diff --git a/libsepol/src/services.c b/libsepol/src/services.c
index eed413f..9c2920c 100644
--- a/libsepol/src/services.c
+++ b/libsepol/src/services.c
@@ -1003,7 +1003,6 @@ int hidden sepol_load_policy(void *data, size_t len)
 	policydb_t oldpolicydb, newpolicydb;
 	sidtab_t oldsidtab, newsidtab;
 	convert_context_args_t args;
-	uint32_t seqno;
 	int rc = 0;
 	struct policy_file file, *fp;
 
@@ -1050,7 +1049,6 @@ int hidden sepol_load_policy(void *data, size_t len)
 	/* Install the new policydb and SID table. */
 	memcpy(policydb, &newpolicydb, sizeof *policydb);
 	sepol_sidtab_set(sidtab, &newsidtab);
-	seqno = ++latest_granting;
 
 	/* Free the old policydb and SID table. */
 	policydb_destroy(&oldpolicydb);
diff --git a/libsepol/src/users.c b/libsepol/src/users.c
index 903fc62..17e1426 100644
--- a/libsepol/src/users.c
+++ b/libsepol/src/users.c
@@ -284,7 +284,7 @@ int sepol_user_modify(sepol_handle_t * handle,
 	return STATUS_ERR;
 }
 
-int sepol_user_exists(sepol_handle_t * handle,
+int sepol_user_exists(sepol_handle_t * handle __attribute__ ((unused)),
 		      const sepol_policydb_t * p,
 		      const sepol_user_key_t * key, int *response)
 {
@@ -301,7 +301,7 @@ int sepol_user_exists(sepol_handle_t * handle,
 	return STATUS_SUCCESS;
 }
 
-int sepol_user_count(sepol_handle_t * handle,
+int sepol_user_count(sepol_handle_t * handle __attribute__ ((unused)),
 		     const sepol_policydb_t * p, unsigned int *response)
 {
 
-- 
1.7.1.rc1.21.gf3bd6


--
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 related	[flat|nested] 11+ messages in thread

* [refpolicy] [PATCH 2/3]libsepol
@ 2010-07-06 22:23   ` Justin P. Mattock
  0 siblings, 0 replies; 11+ messages in thread
From: Justin P. Mattock @ 2010-07-06 22:23 UTC (permalink / raw)
  To: refpolicy

Going through these warning messages Im getting:
(example 1 of many)
booleans.c: In function 'sepol_bool_count':
booleans.c:106:39: error: parameter 'handle' set but not used
cc1: all warnings being treated as errors

seems most of these go to NULL; Which tells me that these are here for
future use and/or need to be there for some other reason.
The biggest problem I have is Im getting errors out of these as opposed
to just a warning(-Werror) so marking the variable with a GCC
__attribute__ ((unused)) gets things going. 
 
Signed-off-by: Justin P. Mattock <justinmattock@gmail.com>

---
 libsepol/src/booleans.c   |    2 +-
 libsepol/src/debug.c      |    2 +-
 libsepol/src/interfaces.c |    4 ++--
 libsepol/src/nodes.c      |    2 +-
 libsepol/src/policydb.c   |    4 +---
 libsepol/src/ports.c      |    2 +-
 libsepol/src/roles.c      |    2 +-
 libsepol/src/services.c   |    2 --
 libsepol/src/users.c      |    4 ++--
 9 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/libsepol/src/booleans.c b/libsepol/src/booleans.c
index 7f37c8b..03f8c98 100644
--- a/libsepol/src/booleans.c
+++ b/libsepol/src/booleans.c
@@ -103,7 +103,7 @@ int sepol_bool_set(sepol_handle_t * handle,
 	return STATUS_ERR;
 }
 
-int sepol_bool_count(sepol_handle_t * handle,
+int sepol_bool_count(sepol_handle_t * handle __attribute__ ((unused)),
 		     const sepol_policydb_t * p, unsigned int *response)
 {
 
diff --git a/libsepol/src/debug.c b/libsepol/src/debug.c
index 552b7d7..51918fd 100644
--- a/libsepol/src/debug.c
+++ b/libsepol/src/debug.c
@@ -41,7 +41,7 @@ hidden_def(sepol_msg_get_fname)
 #ifdef __GNUC__
     __attribute__ ((format(printf, 3, 4)))
 #endif
-void hidden sepol_msg_default_handler(void *varg,
+void hidden sepol_msg_default_handler(void *varg __attribute__ ((unused)),
 				      sepol_handle_t * handle,
 				      const char *fmt, ...)
 {
diff --git a/libsepol/src/interfaces.c b/libsepol/src/interfaces.c
index fd4a001..b82d0f3 100644
--- a/libsepol/src/interfaces.c
+++ b/libsepol/src/interfaces.c
@@ -106,7 +106,7 @@ static int iface_to_record(sepol_handle_t * handle,
 }
 
 /* Check if an interface exists */
-int sepol_iface_exists(sepol_handle_t * handle,
+int sepol_iface_exists(sepol_handle_t * handle __attribute__ ((unused)),
 		       const sepol_policydb_t * p,
 		       const sepol_iface_key_t * key, int *response)
 {
@@ -216,7 +216,7 @@ int sepol_iface_modify(sepol_handle_t * handle,
 }
 
 /* Return the number of interfaces */
-extern int sepol_iface_count(sepol_handle_t * handle,
+extern int sepol_iface_count(sepol_handle_t * handle __attribute__ ((unused)),
 			     const sepol_policydb_t * p, unsigned int *response)
 {
 
diff --git a/libsepol/src/nodes.c b/libsepol/src/nodes.c
index ba2934d..ebf5f1d 100644
--- a/libsepol/src/nodes.c
+++ b/libsepol/src/nodes.c
@@ -144,7 +144,7 @@ static int node_to_record(sepol_handle_t * handle,
 }
 
 /* Return the number of nodes */
-extern int sepol_node_count(sepol_handle_t * handle,
+extern int sepol_node_count(sepol_handle_t * handle __attribute__ ((unused)),
 			    const sepol_policydb_t * p, unsigned int *response)
 {
 
diff --git a/libsepol/src/policydb.c b/libsepol/src/policydb.c
index dae05d3..5c0081f 100644
--- a/libsepol/src/policydb.c
+++ b/libsepol/src/policydb.c
@@ -3234,7 +3234,7 @@ int policydb_read(policydb_t * p, struct policy_file *fp, unsigned verbose)
 {
 
 	unsigned int i, j, r_policyvers;
-	uint32_t buf[5], config;
+	uint32_t buf[5];
 	size_t len, nprim, nel;
 	char *policydb_str;
 	struct policydb_compat_info *info;
@@ -3242,8 +3242,6 @@ int policydb_read(policydb_t * p, struct policy_file *fp, unsigned verbose)
 	ebitmap_node_t *tnode;
 	int rc;
 
-	config = 0;
-
 	/* Read the magic number and string length. */
 	rc = next_entry(buf, fp, sizeof(uint32_t) * 2);
 	if (rc < 0)
diff --git a/libsepol/src/ports.c b/libsepol/src/ports.c
index 06a0743..cbf2a0b 100644
--- a/libsepol/src/ports.c
+++ b/libsepol/src/ports.c
@@ -140,7 +140,7 @@ static int port_to_record(sepol_handle_t * handle,
 }
 
 /* Return the number of ports */
-extern int sepol_port_count(sepol_handle_t * handle,
+extern int sepol_port_count(sepol_handle_t * handle __attribute__ ((unused)),
 			    const sepol_policydb_t * p, unsigned int *response)
 {
 
diff --git a/libsepol/src/roles.c b/libsepol/src/roles.c
index 47aed15..419a3b2 100644
--- a/libsepol/src/roles.c
+++ b/libsepol/src/roles.c
@@ -8,7 +8,7 @@
 #include "handle.h"
 
 /* Check if a role exists */
-int sepol_role_exists(sepol_handle_t * handle,
+int sepol_role_exists(sepol_handle_t * handle __attribute__ ((unused)),
 		      sepol_policydb_t * p, const char *role, int *response)
 {
 
diff --git a/libsepol/src/services.c b/libsepol/src/services.c
index eed413f..9c2920c 100644
--- a/libsepol/src/services.c
+++ b/libsepol/src/services.c
@@ -1003,7 +1003,6 @@ int hidden sepol_load_policy(void *data, size_t len)
 	policydb_t oldpolicydb, newpolicydb;
 	sidtab_t oldsidtab, newsidtab;
 	convert_context_args_t args;
-	uint32_t seqno;
 	int rc = 0;
 	struct policy_file file, *fp;
 
@@ -1050,7 +1049,6 @@ int hidden sepol_load_policy(void *data, size_t len)
 	/* Install the new policydb and SID table. */
 	memcpy(policydb, &newpolicydb, sizeof *policydb);
 	sepol_sidtab_set(sidtab, &newsidtab);
-	seqno = ++latest_granting;
 
 	/* Free the old policydb and SID table. */
 	policydb_destroy(&oldpolicydb);
diff --git a/libsepol/src/users.c b/libsepol/src/users.c
index 903fc62..17e1426 100644
--- a/libsepol/src/users.c
+++ b/libsepol/src/users.c
@@ -284,7 +284,7 @@ int sepol_user_modify(sepol_handle_t * handle,
 	return STATUS_ERR;
 }
 
-int sepol_user_exists(sepol_handle_t * handle,
+int sepol_user_exists(sepol_handle_t * handle __attribute__ ((unused)),
 		      const sepol_policydb_t * p,
 		      const sepol_user_key_t * key, int *response)
 {
@@ -301,7 +301,7 @@ int sepol_user_exists(sepol_handle_t * handle,
 	return STATUS_SUCCESS;
 }
 
-int sepol_user_count(sepol_handle_t * handle,
+int sepol_user_count(sepol_handle_t * handle __attribute__ ((unused)),
 		     const sepol_policydb_t * p, unsigned int *response)
 {
 
-- 
1.7.1.rc1.21.gf3bd6

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

* [PATCH 1/3]libsemanage Fix  warning: parameter 'key' set but not used(and others)
  2010-07-06 22:23 ` [refpolicy] " Justin P. Mattock
@ 2010-07-06 22:23   ` Justin P. Mattock
  -1 siblings, 0 replies; 11+ messages in thread
From: Justin P. Mattock @ 2010-07-06 22:23 UTC (permalink / raw)
  To: selinux; +Cc: refpolicy, Justin P. Mattock

libsemanage produced no errors with the warnings, Im just noticing
big hunks of sections with warning messages:

database_llist.c: In function 'dbase_llist_add':
database_llist.c:150:28: warning: parameter 'key' set but not used
database_llist.c: In function 'dbase_llist_count':
database_llist.c:221:50: warning: parameter 'handle' set but not used
database_llist.c: In function 'dbase_llist_del':
database_llist.c:278:41: warning: parameter 'handle' set but not used
(and so on...)
so add the GCC attribute to quiet these warnings since most go to
NULL;

Signed-off-by: Justin P. Mattock <justinmattock@gmail.com>

---
 libsemanage/src/database_llist.c    |    7 ++++---
 libsemanage/src/database_policydb.c |   18 ++++++++++++------
 libsemanage/src/debug.c             |    2 +-
 libsemanage/src/direct_api.c        |    3 ++-
 4 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/libsemanage/src/database_llist.c b/libsemanage/src/database_llist.c
index 1cb7454..5f0c147 100644
--- a/libsemanage/src/database_llist.c
+++ b/libsemanage/src/database_llist.c
@@ -147,7 +147,8 @@ int dbase_llist_exists(semanage_handle_t * handle,
 
 int dbase_llist_add(semanage_handle_t * handle,
 		    dbase_llist_t * dbase,
-		    const record_key_t * key, const record_t * data)
+		    const record_key_t * key __attribute__ ((unused)),
+			 const record_t * data)
 {
 
 	if (dbase_llist_cache_prepend(handle, dbase, data) < 0)
@@ -218,7 +219,7 @@ int dbase_llist_modify(semanage_handle_t * handle,
 	return STATUS_ERR;
 }
 
-hidden int dbase_llist_count(semanage_handle_t * handle,
+hidden int dbase_llist_count(semanage_handle_t * handle __attribute__ ((unused)),
 			     dbase_llist_t * dbase, unsigned int *response)
 {
 
@@ -275,7 +276,7 @@ int dbase_llist_iterate(semanage_handle_t * handle,
 	return STATUS_ERR;
 }
 
-int dbase_llist_del(semanage_handle_t * handle,
+int dbase_llist_del(semanage_handle_t * handle __attribute__ ((unused)),
 		    dbase_llist_t * dbase, const record_key_t * key)
 {
 
diff --git a/libsemanage/src/database_policydb.c b/libsemanage/src/database_policydb.c
index 839dcbe..94850b7 100644
--- a/libsemanage/src/database_policydb.c
+++ b/libsemanage/src/database_policydb.c
@@ -177,7 +177,8 @@ static int dbase_policydb_cache(semanage_handle_t * handle,
 	return STATUS_ERR;
 }
 
-static int dbase_policydb_flush(semanage_handle_t * handle,
+static int dbase_policydb_flush(semanage_handle_t * handle
+				__attribute__ ((unused)),
 				dbase_policydb_t * dbase)
 {
 
@@ -309,9 +310,12 @@ static int dbase_policydb_modify(semanage_handle_t * handle,
 	return STATUS_ERR;
 }
 
-static int dbase_policydb_del(semanage_handle_t * handle,
-			      dbase_policydb_t * dbase,
-			      const record_key_t * key)
+static int dbase_policydb_del(semanage_handle_t * handle
+				__attribute__ ((unused)),
+			      dbase_policydb_t * dbase
+				__attribute__ ((unused)),
+			      const record_key_t * key
+				__attribute__ ((unused)))
 {
 
 	/* Stub */
@@ -321,8 +325,10 @@ static int dbase_policydb_del(semanage_handle_t * handle,
 	return STATUS_ERR;
 }
 
-static int dbase_policydb_clear(semanage_handle_t * handle,
-				dbase_policydb_t * dbase)
+static int dbase_policydb_clear(semanage_handle_t * handle
+				__attribute__ ((unused)),
+				dbase_policydb_t * dbase
+				__attribute__ ((unused)))
 {
 
 	/* Stub */
diff --git a/libsemanage/src/debug.c b/libsemanage/src/debug.c
index 4b96c30..90d4b4e 100644
--- a/libsemanage/src/debug.c
+++ b/libsemanage/src/debug.c
@@ -51,7 +51,7 @@ hidden_def(semanage_msg_get_fname)
 #ifdef __GNUC__
     __attribute__ ((format(printf, 3, 4)))
 #endif
-void hidden semanage_msg_default_handler(void *varg,
+void hidden semanage_msg_default_handler(void *varg __attribute__ ((unused)),
 					 semanage_handle_t * handle,
 					 const char *fmt, ...)
 {
diff --git a/libsemanage/src/direct_api.c b/libsemanage/src/direct_api.c
index 399d740..bceb6a7 100644
--- a/libsemanage/src/direct_api.c
+++ b/libsemanage/src/direct_api.c
@@ -243,7 +243,8 @@ int semanage_direct_connect(semanage_handle_t * sh)
 	return STATUS_ERR;
 }
 
-static void semanage_direct_destroy(semanage_handle_t * sh)
+static void semanage_direct_destroy(semanage_handle_t * sh
+					__attribute__ ((unused)))
 {
 	/* do nothing */
 	sh = NULL;
-- 
1.7.1.rc1.21.gf3bd6


--
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 related	[flat|nested] 11+ messages in thread

* [refpolicy] [PATCH 1/3]libsemanage Fix warning: parameter 'key' set but not used(and others)
@ 2010-07-06 22:23   ` Justin P. Mattock
  0 siblings, 0 replies; 11+ messages in thread
From: Justin P. Mattock @ 2010-07-06 22:23 UTC (permalink / raw)
  To: refpolicy

libsemanage produced no errors with the warnings, Im just noticing
big hunks of sections with warning messages:

database_llist.c: In function 'dbase_llist_add':
database_llist.c:150:28: warning: parameter 'key' set but not used
database_llist.c: In function 'dbase_llist_count':
database_llist.c:221:50: warning: parameter 'handle' set but not used
database_llist.c: In function 'dbase_llist_del':
database_llist.c:278:41: warning: parameter 'handle' set but not used
(and so on...)
so add the GCC attribute to quiet these warnings since most go to
NULL;

Signed-off-by: Justin P. Mattock <justinmattock@gmail.com>

---
 libsemanage/src/database_llist.c    |    7 ++++---
 libsemanage/src/database_policydb.c |   18 ++++++++++++------
 libsemanage/src/debug.c             |    2 +-
 libsemanage/src/direct_api.c        |    3 ++-
 4 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/libsemanage/src/database_llist.c b/libsemanage/src/database_llist.c
index 1cb7454..5f0c147 100644
--- a/libsemanage/src/database_llist.c
+++ b/libsemanage/src/database_llist.c
@@ -147,7 +147,8 @@ int dbase_llist_exists(semanage_handle_t * handle,
 
 int dbase_llist_add(semanage_handle_t * handle,
 		    dbase_llist_t * dbase,
-		    const record_key_t * key, const record_t * data)
+		    const record_key_t * key __attribute__ ((unused)),
+			 const record_t * data)
 {
 
 	if (dbase_llist_cache_prepend(handle, dbase, data) < 0)
@@ -218,7 +219,7 @@ int dbase_llist_modify(semanage_handle_t * handle,
 	return STATUS_ERR;
 }
 
-hidden int dbase_llist_count(semanage_handle_t * handle,
+hidden int dbase_llist_count(semanage_handle_t * handle __attribute__ ((unused)),
 			     dbase_llist_t * dbase, unsigned int *response)
 {
 
@@ -275,7 +276,7 @@ int dbase_llist_iterate(semanage_handle_t * handle,
 	return STATUS_ERR;
 }
 
-int dbase_llist_del(semanage_handle_t * handle,
+int dbase_llist_del(semanage_handle_t * handle __attribute__ ((unused)),
 		    dbase_llist_t * dbase, const record_key_t * key)
 {
 
diff --git a/libsemanage/src/database_policydb.c b/libsemanage/src/database_policydb.c
index 839dcbe..94850b7 100644
--- a/libsemanage/src/database_policydb.c
+++ b/libsemanage/src/database_policydb.c
@@ -177,7 +177,8 @@ static int dbase_policydb_cache(semanage_handle_t * handle,
 	return STATUS_ERR;
 }
 
-static int dbase_policydb_flush(semanage_handle_t * handle,
+static int dbase_policydb_flush(semanage_handle_t * handle
+				__attribute__ ((unused)),
 				dbase_policydb_t * dbase)
 {
 
@@ -309,9 +310,12 @@ static int dbase_policydb_modify(semanage_handle_t * handle,
 	return STATUS_ERR;
 }
 
-static int dbase_policydb_del(semanage_handle_t * handle,
-			      dbase_policydb_t * dbase,
-			      const record_key_t * key)
+static int dbase_policydb_del(semanage_handle_t * handle
+				__attribute__ ((unused)),
+			      dbase_policydb_t * dbase
+				__attribute__ ((unused)),
+			      const record_key_t * key
+				__attribute__ ((unused)))
 {
 
 	/* Stub */
@@ -321,8 +325,10 @@ static int dbase_policydb_del(semanage_handle_t * handle,
 	return STATUS_ERR;
 }
 
-static int dbase_policydb_clear(semanage_handle_t * handle,
-				dbase_policydb_t * dbase)
+static int dbase_policydb_clear(semanage_handle_t * handle
+				__attribute__ ((unused)),
+				dbase_policydb_t * dbase
+				__attribute__ ((unused)))
 {
 
 	/* Stub */
diff --git a/libsemanage/src/debug.c b/libsemanage/src/debug.c
index 4b96c30..90d4b4e 100644
--- a/libsemanage/src/debug.c
+++ b/libsemanage/src/debug.c
@@ -51,7 +51,7 @@ hidden_def(semanage_msg_get_fname)
 #ifdef __GNUC__
     __attribute__ ((format(printf, 3, 4)))
 #endif
-void hidden semanage_msg_default_handler(void *varg,
+void hidden semanage_msg_default_handler(void *varg __attribute__ ((unused)),
 					 semanage_handle_t * handle,
 					 const char *fmt, ...)
 {
diff --git a/libsemanage/src/direct_api.c b/libsemanage/src/direct_api.c
index 399d740..bceb6a7 100644
--- a/libsemanage/src/direct_api.c
+++ b/libsemanage/src/direct_api.c
@@ -243,7 +243,8 @@ int semanage_direct_connect(semanage_handle_t * sh)
 	return STATUS_ERR;
 }
 
-static void semanage_direct_destroy(semanage_handle_t * sh)
+static void semanage_direct_destroy(semanage_handle_t * sh
+					__attribute__ ((unused)))
 {
 	/* do nothing */
 	sh = NULL;
-- 
1.7.1.rc1.21.gf3bd6

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

* Re: [PATCH 2/3]libsepol
  2010-07-06 22:23   ` [refpolicy] " Justin P. Mattock
  (?)
@ 2010-07-07 11:14   ` Russell Coker
  2010-07-07 13:28     ` Justin P. Mattock
  -1 siblings, 1 reply; 11+ messages in thread
From: Russell Coker @ 2010-07-07 11:14 UTC (permalink / raw)
  To: Justin P. Mattock; +Cc: selinux

On Wed, 7 Jul 2010, "Justin P. Mattock" <justinmattock@gmail.com> wrote:
> --- a/libsepol/src/services.c
> +++ b/libsepol/src/services.c
> @@ -1050,7 +1049,6 @@ int hidden sepol_load_policy(void *data, size_t len)
>         /* Install the new policydb and SID table. */
>         memcpy(policydb, &newpolicydb, sizeof *policydb);
>         sepol_sidtab_set(sidtab, &newsidtab);
> -       seqno = ++latest_granting;
>  
>         /* Free the old policydb and SID table. */
>         policydb_destroy(&oldpolicydb);

Is latest_granting used for anything else?  If it's not being used then it 
should be removed too.  If it is being used then failing to increment it 
breaks something.

-- 
russell@coker.com.au
http://etbe.coker.com.au/          My Main Blog
http://doc.coker.com.au/           My Documents Blog

--
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] 11+ messages in thread

* Re: [PATCH 2/3]libsepol
  2010-07-07 11:14   ` Russell Coker
@ 2010-07-07 13:28     ` Justin P. Mattock
  0 siblings, 0 replies; 11+ messages in thread
From: Justin P. Mattock @ 2010-07-07 13:28 UTC (permalink / raw)
  To: russell; +Cc: selinux

On 07/07/2010 04:14 AM, Russell Coker wrote:
> On Wed, 7 Jul 2010, "Justin P. Mattock"<justinmattock@gmail.com>  wrote:
>> --- a/libsepol/src/services.c
>> +++ b/libsepol/src/services.c
>> @@ -1050,7 +1049,6 @@ int hidden sepol_load_policy(void *data, size_t len)
>>          /* Install the new policydb and SID table. */
>>          memcpy(policydb,&newpolicydb, sizeof *policydb);
>>          sepol_sidtab_set(sidtab,&newsidtab);
>> -       seqno = ++latest_granting;
>>
>>          /* Free the old policydb and SID table. */
>>          policydb_destroy(&oldpolicydb);
>
> Is latest_granting used for anything else?  If it's not being used then it
> should be removed too.  If it is being used then failing to increment it
> breaks something.
>

doing a grep for all packages shows me this:(no grep in the kernel or 
elsewhere

selinux/libsepol/src/services.c:112:static uint32_t latest_granting = 0;
selinux/libsepol/src/services.c:335:    avd->seqno = latest_granting;
selinux/libsepol/src/services.c:1053:   seqno = ++latest_granting;


Justin P. Mattock


--
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] 11+ messages in thread

* Re: [refpolicy] [PATCH 0/3] Fix warning messages generated by GCC 4.6
  2010-07-06 22:23 ` [refpolicy] " Justin P. Mattock
                   ` (3 preceding siblings ...)
  (?)
@ 2010-12-16 19:19 ` Chad Sellers
  -1 siblings, 0 replies; 11+ messages in thread
From: Chad Sellers @ 2010-12-16 19:19 UTC (permalink / raw)
  To: Justin P. Mattock, selinux

On 7/6/10 6:23 PM, "Justin P. Mattock" <justinmattock@gmail.com> wrote:

> 
> 
> 
> Here is a set of patches that get me up and running without any
> errors, nor warnings from GCC(or atleast most of them).
> Seems with the latest 4.6 there's more enforcement envolved
> with these i.e. one machine with GCC 4.4 compiles fine,
> and on the other hand the later GCC I get errors(-Werror)
> and stoppage etc...
> 
> In any case if you like what you see let me know, if not let
> me know so that I can make the appropriate change's to fix
> this and make things good excetra..
> 
> Justin P. Mattock

This whole set looks good to me. Merged as of checkpolicy 2.0.23, libsepol
2.0.42, and libsemanage 2.0.46.

Acked-by: Chad Sellers <csellers@tresys.com>


--
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] 11+ messages in thread

end of thread, other threads:[~2010-12-16 19:19 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-06 22:23 [PATCH 0/3] Fix warning messages generated by GCC 4.6 Justin P. Mattock
2010-07-06 22:23 ` [refpolicy] " Justin P. Mattock
2010-07-06 22:23 ` [PATCH 1/3]checkpolicy Fix error: variable 'newattr' set but not used(and others as well) Justin P. Mattock
2010-07-06 22:23   ` [refpolicy] " Justin P. Mattock
2010-07-06 22:23 ` [PATCH 2/3]libsepol Justin P. Mattock
2010-07-06 22:23   ` [refpolicy] " Justin P. Mattock
2010-07-07 11:14   ` Russell Coker
2010-07-07 13:28     ` Justin P. Mattock
2010-07-06 22:23 ` [PATCH 1/3]libsemanage Fix warning: parameter 'key' set but not used(and others) Justin P. Mattock
2010-07-06 22:23   ` [refpolicy] " Justin P. Mattock
2010-12-16 19:19 ` [refpolicy] [PATCH 0/3] Fix warning messages generated by GCC 4.6 Chad Sellers

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.