diff lwasm/input.c @ 2:7317fbe024af

Clean up insane number of compiler warnings under -Wall
author lost@l-w.ca
date Thu, 20 Jan 2011 22:39:46 -0700
parents 2c24602be78f
children 127e5b1e01c0
line wrap: on
line diff
--- a/lwasm/input.c	Wed Jan 19 22:31:00 2011 -0700
+++ b/lwasm/input.c	Thu Jan 20 22:39:46 2011 -0700
@@ -32,6 +32,8 @@
 #include <lw_alloc.h>
 #include <lw_stringlist.h>
 #include <lw_string.h>
+#include <lw_error.h>
+
 #include "lwasm.h"
 
 /*
@@ -82,7 +84,7 @@
 	
 	/* also add it to the list of files included */
 	char *dn, *dp;
-	int o;
+//	int o;
 
 	dn = lw_strdup(fn);
 	lw_stack_push(as -> includelist, dn);
@@ -177,7 +179,7 @@
 		
 		/* relative path, check relative to "current file" directory */
 		p = lw_stack_top(as -> file_dir);
-		0 == asprintf(&p2, "%s/%s", p, s);
+		(void)(0 == asprintf(&p2, "%s/%s", p, s));
 		debug_message(as, 1, "Open: (cd) %s\n", p2);
 		IS -> data = fopen(p2, "rb");
 		if (IS -> data)
@@ -191,9 +193,9 @@
 
 		/* now check relative to entries in the search path */
 		lw_stringlist_reset(as -> include_list);
-		while (p = lw_stringlist_current(as -> include_list))
+		while ((p = lw_stringlist_current(as -> include_list)))
 		{
-			0 == asprintf(&p2, "%s/%s", p, s);
+			(void)(0 == asprintf(&p2, "%s/%s", p, s));
 		debug_message(as, 1, "Open (sp): %s\n", p2);
 			IS -> data = fopen(p2, "rb");
 			if (IS -> data)
@@ -226,7 +228,7 @@
 
 FILE *input_open_standalone(asmstate_t *as, char *s)
 {
-	char *s2;
+//	char *s2;
 	FILE *fp;
 	char *p, *p2;
 
@@ -245,7 +247,7 @@
 
 	/* relative path, check relative to "current file" directory */
 	p = lw_stack_top(as -> file_dir);
-	0 == asprintf(&p2, "%s/%s", p, s);
+	(void)(0 == asprintf(&p2, "%s/%s", p, s));
 	debug_message(as, 2, "Open file (st cd) %s", p2);
 	fp = fopen(p2, "rb");
 	if (fp)
@@ -257,9 +259,9 @@
 
 	/* now check relative to entries in the search path */
 	lw_stringlist_reset(as -> include_list);
-	while (p = lw_stringlist_current(as -> include_list))
+	while ((p = lw_stringlist_current(as -> include_list)))
 	{
-		0 == asprintf(&p2, "%s/%s", p, s);
+		(void)(0 == asprintf(&p2, "%s/%s", p, s));
 		debug_message(as, 2, "Open file (st ip) %s", p2);
 		fp = fopen(p2, "rb");
 		if (fp)
@@ -402,6 +404,7 @@
 	
 	default:
 		lw_error("Problem reading from unknown input type");
+		return NULL;
 	}
 }