shithub: scc

Download patch

ref: 6b19dacc73f265c688c7ea1f6b371f6dd5525924
parent: 98d60a06534921e0b79dd3b0a13910f2a8ec83a9
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Tue Sep 24 13:53:51 EDT 2013

Change warning_error to warn

warning is never called because we always use warning_error, so
it is a nonsense this long name, which causes a lot of indentation.
We remove warning and rename warning_error to warn.

--- a/cc.h
+++ b/cc.h
@@ -18,10 +18,9 @@
 
 extern  struct user_opt options;
 
-extern void warning(const char *fmt, ...);
 extern void error(const char *fmt, ...);
 extern void die(const char *fmt, ...);
-extern void warning_error(char flag, const char *fmt, ...);
+extern void warn(char flag, const char *fmt, ...);
 extern void *xmalloc(size_t size);
 extern void *xcalloc(size_t nmemb, size_t size);
 extern char *xstrdup(const char *s);
--- a/decl.c
+++ b/decl.c
@@ -106,8 +106,8 @@
 	if (!(base = spec())) {
 		base = newctype();
 		base->type = INT;
-		warning_error(options.implicit,
-		              "data definition has no type or storage class");
+		warn(options.implicit,
+		     "data definition has no type or storage class");
 	}
 	if (base->c_typedef  || base->c_static || base->c_auto ||
 	    base->c_register || base->c_extern) {
@@ -217,8 +217,8 @@
 			if (!tp)
 				return NULL;
 			if (!tp->type) {
-				warning_error(options.implicit,
-			                      "type defaults to 'int' in declaration");
+				warn(options.implicit,
+			             "type defaults to 'int' in declaration");
 				tp->type = INT;
 			}
 			if (!tp->c_signed && !tp->c_unsigned) {
@@ -326,8 +326,8 @@
 			return NULL;
 		tp = newctype();
 		tp->type = INT;
-		warning_error(options.implicit,
-		              "data definition has no type or storage class");
+		warn(options.implicit,
+		     "data definition has no type or storage class");
 	} else if (accept(';')) {
 		register unsigned char type = tp->type;
 
@@ -334,12 +334,12 @@
 		if (type == STRUCT || type == UNION || type == ENUM) {
 			if (tp->c_extern || tp->c_static || tp->c_auto ||
 			    tp->c_register || tp->c_const || tp->c_volatile) {
-				warning_error(options.useless,
-				              "useless storage class specifier in empty declaration");
+				warn(options.useless,
+				     "useless storage class specifier in empty declaration");
 			}
 		} else {
-			warning_error(options.useless,
-			              "useless type name in empty declaration");
+			warn(options.useless,
+			     "useless type name in empty declaration");
 		}
 		delctype(tp);
 		goto repeat;
--- a/error.c
+++ b/error.c
@@ -9,7 +9,7 @@
 
 
 static void
-warning_error_helper(char flag, const char *fmt, va_list va)
+warn_helper(char flag, const char *fmt, va_list va)
 {
 	fprintf(stderr, "%s:%s:%u:%u: ",
 		(!flag) ? "warning" : "error", filename, linenum, columnum);
@@ -20,11 +20,11 @@
 }
 
 void
-warning_error(char flag, const char *fmt, ...)
+warn(char flag, const char *fmt, ...)
 {
 	va_list va;
 	va_start(va, fmt);
-	warning_error_helper(flag, fmt, va);
+	warn_helper(flag, fmt, va);
 	va_end(va);
 }
 
@@ -33,16 +33,7 @@
 {
 	va_list va;
 	va_start(va, fmt);
-	warning_error_helper(1, fmt, va);
-	va_end(va);
-}
-
-void
-warning(const char *fmt, ...)
-{
-	va_list va;
-	va_start(va, fmt);
-	warning_error_helper(0, fmt, va);
+	warn_helper(1, fmt, va);
 	va_end(va);
 }
 
--