[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-sparse
Subject:    [BK PATCH] warning -> error
From:       terra () gnome ! org (Morten Welinder)
Date:       2004-09-13 20:33:48
Message-ID: 20040913203348.68CD51422D5E () darter ! rentec ! com
[Download RAW message or body]


This changes a ton of warning() calls to error() calls.  The only effect
right now of that is that they will print "error", not "warning".  (Well,
and they get their own limit of 100.)

I could easily have forgotten a bunch.  We can fix those as we stumble
upon them.

Morten




Linus, please do a

	bk pull http://sparse-mw.bkbits.net:8080/for-linus

This will update the following files:

 evaluate.c    |   64 ++++++++++++++++++++++++++++----------------------------
 expand.c      |   10 ++++----
 parse.c       |   66 +++++++++++++++++++++++++++++-----------------------------
 pre-process.c |    6 ++---
 4 files changed, 73 insertions(+), 73 deletions(-)

through these ChangeSets:

<welinder@troll.com> (04/09/13 1.793)
   Change many warning() calls to error() calls.

<welinder@troll.com> (04/09/13 1.792)
   Ok, unsigned it is.

<welinder@troll.com> (04/09/13 1.789.1.1)
   Allocate enough for a 32-bit integer.

diff -Nru a/evaluate.c b/evaluate.c
--- a/evaluate.c	2004-09-13 16:29:46 -04:00
+++ b/evaluate.c	2004-09-13 16:29:46 -04:00
@@ -40,17 +40,17 @@
 			expr->ctype = &int_ctype;
 			return &int_ctype;
 		}
-		warning(expr->pos, "undefined identifier '%s'", show_ident(expr->symbol_name));
+		error(expr->pos, "undefined identifier '%s'", show_ident(expr->symbol_name));
 		return NULL;
 	}
 
 	examine_symbol_type(sym);
 	if ((sym->ctype.context ^ current_context) & (sym->ctype.contextmask & \
                current_contextmask))
-		warning(expr->pos, "Using symbol '%s' in wrong context", \
show_ident(expr->symbol_name)); +		error(expr->pos, "Using symbol '%s' in wrong \
context", show_ident(expr->symbol_name));  
 	base_type = sym->ctype.base_type;
 	if (!base_type) {
-		warning(expr->pos, "identifier '%s' has no type", show_ident(expr->symbol_name));
+		error(expr->pos, "identifier '%s' has no type", show_ident(expr->symbol_name));
 		return NULL;
 	}
 
@@ -215,7 +215,7 @@
 
 static struct symbol *bad_expr_type(struct expression *expr)
 {
-	warning(expr->pos, "incompatible types for operation (%s)", \
show_special(expr->op)); +	error(expr->pos, "incompatible types for operation (%s)", \
show_special(expr->op));  switch (expr->type) {
 	case EXPR_BINOP:
 	case EXPR_COMPARE:
@@ -387,7 +387,7 @@
 
 	ctype = degenerate(ptr);
 	if (!ctype->ctype.base_type) {
-		warning(expr->pos, "missing type information");
+		error(expr->pos, "missing type information");
 		return NULL;
 	}
 
@@ -623,7 +623,7 @@
 	if (typediff) {
 		ctype = common_ptr_type(l, r);
 		if (!ctype) {
-			warning(expr->pos, "subtraction of different types can't work (%s)", typediff);
+			error(expr->pos, "subtraction of different types can't work (%s)", typediff);
 			return NULL;
 		}
 	}
@@ -633,7 +633,7 @@
 	if (ctype->type == SYM_NODE)
 		ctype = ctype->ctype.base_type;
 	if (ctype->type != SYM_PTR && ctype->type != SYM_ARRAY) {
-		warning(expr->pos, "subtraction of functions? Share your drugs");
+		error(expr->pos, "subtraction of functions? Share your drugs");
 		return NULL;
 	}
 	ctype = ctype->ctype.base_type;
@@ -892,7 +892,7 @@
 	ctype = compatible_restricted_binop('?', &expr->left, &expr->right);
 	if (ctype)
 		goto out;
-	warning(expr->pos, "incompatible types in conditional expression (%s)", typediff);
+	error(expr->pos, "incompatible types in conditional expression (%s)", typediff);
 	return NULL;
 
 out:
@@ -963,7 +963,7 @@
 		}
 	}
 
-	warning(expr->pos, "incorrect type in %s (%s)", where, typediff);
+	error(expr->pos, "incorrect type in %s (%s)", where, typediff);
 	info(expr->pos, "   expected %s", show_typename(target));
 	info(expr->pos, "   got %s", show_typename(source));
 	*rp = cast_to(*rp, target);
@@ -1069,7 +1069,7 @@
 	struct symbol *ltype, *rtype;
 
 	if (!lvalue_expression(left)) {
-		warning(expr->pos, "not an lvalue");
+		error(expr->pos, "not an lvalue");
 		return NULL;
 	}
 
@@ -1239,7 +1239,7 @@
 		}
 	case SYM_FN:
 		if (expr->op != '*' || expr->type != EXPR_PREOP) {
-			warning(expr->pos, "strange non-value function or array");
+			error(expr->pos, "strange non-value function or array");
 			return NULL;
 		}
 		*expr = *expr->unop;
@@ -1257,7 +1257,7 @@
 	struct symbol *ctype;
 
 	if (op->op != '*' || op->type != EXPR_PREOP) {
-		warning(expr->pos, "not addressable");
+		error(expr->pos, "not addressable");
 		return NULL;
 	}
 	ctype = op->ctype;
@@ -1296,7 +1296,7 @@
 
 	switch (ctype->type) {
 	default:
-		warning(expr->pos, "cannot derefence this type");
+		error(expr->pos, "cannot derefence this type");
 		return NULL;
 	case SYM_PTR:
 		merge_type(node, ctype);
@@ -1318,7 +1318,7 @@
 
 	case SYM_ARRAY:
 		if (!lvalue_expression(op)) {
-			warning(op->pos, "non-lvalue array??");
+			error(op->pos, "non-lvalue array??");
 			return NULL;
 		}
 
@@ -1350,11 +1350,11 @@
 	struct symbol *ctype = op->ctype;
 
 	if (!lvalue_expression(expr->unop)) {
-		warning(expr->pos, "need lvalue expression for ++/--");
+		error(expr->pos, "need lvalue expression for ++/--");
 		return NULL;
 	}
 	if (is_restricted_type(ctype) && restricted_unop(expr->op, ctype)) {
-		warning(expr->pos, "bad operation on restricted");
+		error(expr->pos, "bad operation on restricted");
 		return NULL;
 	}
 
@@ -1510,7 +1510,7 @@
 	if (!evaluate_expression(deref))
 		return NULL;
 	if (!ident) {
-		warning(expr->pos, "bad member name");
+		error(expr->pos, "bad member name");
 		return NULL;
 	}
 
@@ -1523,7 +1523,7 @@
 		mod |= ctype->ctype.modifiers;
 	}
 	if (!ctype || (ctype->type != SYM_STRUCT && ctype->type != SYM_UNION)) {
-		warning(expr->pos, "expected structure or union");
+		error(expr->pos, "expected structure or union");
 		return NULL;
 	}
 	offset = 0;
@@ -1536,8 +1536,8 @@
 			name = ctype->ident->name;
 			namelen = ctype->ident->len;
 		}
-		warning(expr->pos, "no member '%s' in %s %.*s",
-			show_ident(ident), type, namelen, name);
+		error(expr->pos, "no member '%s' in %s %.*s",
+		      show_ident(ident), type, namelen, name);
 		return NULL;
 	}
 
@@ -1641,7 +1641,7 @@
 				size = bits_in_int;
 		}
 		if (is_bitfield_type(what->ctype))
-			warning(expr->pos, "sizeof applied to bitfield type");
+			error(expr->pos, "sizeof applied to bitfield type");
 	}
 	if (size & 7)
 		warning(expr->pos, "cannot size expression");
@@ -1661,7 +1661,7 @@
 			return NULL;
 	}
 	if (is_bitfield_type(type))
-		warning(expr->pos, "alignof applied to bitfield type");
+		error(expr->pos, "alignof applied to bitfield type");
 	examine_symbol_type(type);
 	expr->type = EXPR_VALUE;
 	expr->value = type->ctype.alignment;
@@ -1693,7 +1693,7 @@
 			return 0;
 
 		if (context_clash(f, ctype))
-			warning(expr->pos, "argument %d used in wrong context", i);
+			error(expr->pos, "argument %d used in wrong context", i);
 
 		ctype = degenerate(expr);
 
@@ -1749,7 +1749,7 @@
 static int evaluate_scalar_initializer(struct symbol *ctype, struct expression \
*expr, unsigned long offset)  {
 	if (offset || expression_list_size(expr->expr_list) != 1) {
-		warning(expr->pos, "unexpected compound initializer");
+		error(expr->pos, "unexpected compound initializer");
 		return 0;
 	}
 	return evaluate_array_initializer(ctype, expr, 0);
@@ -1772,7 +1772,7 @@
 			RESET_PTR_LIST(sym);
 			for (;;) {
 				if (!sym) {
-					warning(entry->pos, "unknown named initializer '%s'", show_ident(ident));
+					error(entry->pos, "unknown named initializer '%s'", show_ident(ident));
 					return 0;
 				}
 				if (sym->ident == ident)
@@ -1783,7 +1783,7 @@
 		}
 
 		if (!sym) {
-			warning(expr->pos, "too many initializers for struct/union");
+			error(expr->pos, "too many initializers for struct/union");
 			return 0;
 		}
 
@@ -1957,7 +1957,7 @@
 		warning(expr->pos, "cast to non-scalar");
 
 	if (!target->ctype) {
-		warning(expr->pos, "cast from unknown type");
+		error(expr->pos, "cast from unknown type");
 		goto out;
 	}
 
@@ -2052,7 +2052,7 @@
 	if (!evaluate_arguments(sym, ctype, arglist))
 		return NULL;
 	if (ctype->type != SYM_FN) {
-		warning(expr->pos, "not a function %s", show_ident(sym->ident));
+		error(expr->pos, "not a function %s", show_ident(sym->ident));
 		return NULL;
 	}
 	args = expression_list_size(expr->args);
@@ -2079,7 +2079,7 @@
 	switch (expr->type) {
 	case EXPR_VALUE:
 	case EXPR_FVALUE:
-		warning(expr->pos, "value expression without a type");
+		error(expr->pos, "value expression without a type");
 		return NULL;
 	case EXPR_STRING:
 		return evaluate_string(expr);
@@ -2129,7 +2129,7 @@
 	case EXPR_CALL:
 		return evaluate_call(expr);
 	case EXPR_BITFIELD:
-		warning(expr->pos, "bitfield generated by parser");
+		error(expr->pos, "bitfield generated by parser");
 		return NULL;
 	case EXPR_SELECT:
 	case EXPR_CONDITIONAL:
@@ -2160,10 +2160,10 @@
 	case EXPR_IDENTIFIER:
 	case EXPR_INDEX:
 	case EXPR_POS:
-		warning(expr->pos, "internal front-end error: initializer in expression");
+		error(expr->pos, "internal front-end error: initializer in expression");
 		return NULL;
 	case EXPR_SLICE:
-		warning(expr->pos, "internal front-end error: SLICE re-evaluated");
+		error(expr->pos, "internal front-end error: SLICE re-evaluated");
 		return NULL;
 	}
 	return NULL;
diff -Nru a/expand.c b/expand.c
--- a/expand.c	2004-09-13 16:29:46 -04:00
+++ b/expand.c	2004-09-13 16:29:46 -04:00
@@ -739,7 +739,7 @@
 		return expand_call(expr);
 
 	case EXPR_DEREF:
-		warning(expr->pos, "we should not have an EXPR_DEREF left at expansion time");
+		error(expr->pos, "we should not have an EXPR_DEREF left at expansion time");
 		return UNSAFE;
 
 	case EXPR_BITFIELD:
@@ -772,7 +772,7 @@
 
 	case EXPR_SIZEOF:
 	case EXPR_ALIGNOF:
-		warning(expr->pos, "internal front-end error: sizeof in expansion?");
+		error(expr->pos, "internal front-end error: sizeof in expansion?");
 		return UNSAFE;
 	}
 	return SIDE_EFFECTS;
@@ -783,7 +783,7 @@
 	if (expr) {
 		expand_expression(expr);
 		if (expr->type != EXPR_VALUE)
-			warning(expr->pos, "Expected constant expression in %s", where);
+			error(expr->pos, "Expected constant expression in %s", where);
 	}
 }
 
@@ -919,12 +919,12 @@
 		return 0;
 	ctype = evaluate_expression(expr);
 	if (!ctype) {
-		warning(expr->pos, "bad constant expression type");
+		error(expr->pos, "bad constant expression type");
 		return 0;
 	}
 	expand_expression(expr);
 	if (expr->type != EXPR_VALUE) {
-		warning(expr->pos, "bad constant expression");
+		error(expr->pos, "bad constant expression");
 		return 0;
 	}
 
diff -Nru a/parse.c b/parse.c
--- a/parse.c	2004-09-13 16:29:46 -04:00
+++ b/parse.c	2004-09-13 16:29:46 -04:00
@@ -134,7 +134,7 @@
 
 	// private struct/union/enum type
 	if (!match_op(token, '{')) {
-		warning(token->pos, "expected declaration");
+		error(token->pos, "expected declaration");
 		ctype->base_type = &bad_type;
 		return token;
 	}
@@ -193,7 +193,7 @@
 	struct symbol *sym;
 
 	if (!match_op(token, '(')) {
-		warning(token->pos, "expected '(' after typeof");
+		error(token->pos, "expected '(' after typeof");
 		return token;
 	}
 	if (lookup_type(token->next)) {
@@ -351,7 +351,7 @@
 	token = expect(token, '(', "after attribute");
 
 	for (;;) {
-		const char *error;
+		const char *err;
 		struct ident *attribute_name;
 		struct expression *attribute_expr;
 
@@ -366,9 +366,9 @@
 		attribute_expr = NULL;
 		if (match_op(token, '('))
 			token = parens_expression(token, &attribute_expr, "in attribute");
-		error = handle_attribute(ctype, attribute_name, attribute_expr);
-		if (error)
-			warning(token->pos, "attribute '%s': %s", show_ident(attribute_name), error);
+		err = handle_attribute(ctype, attribute_name, attribute_expr);
+		if (err)
+			error(token->pos, "attribute '%s': %s", show_ident(attribute_name), err);
 		if (!match_op(token, ','))
 			break;
 		token = token->next;
@@ -440,29 +440,29 @@
 		}
 		dup = (mod & old) | (extra & old) | (extra & mod);
 		if (dup)
-			warning(pos, "Just how %sdo you want this type to be?",
-				modifier_string(dup));
+			error(pos, "Just how %sdo you want this type to be?",
+			      modifier_string(dup));
 
 		conflict = !(~mod & ~old & (MOD_LONG | MOD_SHORT));
 		if (conflict)
-			warning(pos, "You cannot have both long and short modifiers.");
+			error(pos, "You cannot have both long and short modifiers.");
 
 		conflict = !(~mod & ~old & (MOD_SIGNED | MOD_UNSIGNED));
 		if (conflict)
-			warning(pos, "You cannot have both signed and unsigned modifiers.");
+			error(pos, "You cannot have both signed and unsigned modifiers.");
 
 		// Only one storage modifier allowed, except that "inline" doesn't count.
 		conflict = (mod | old) & (MOD_STORAGE & ~MOD_INLINE);
 		conflict &= (conflict - 1);
 		if (conflict)
-			warning(pos, "multiple storage classes");
+			error(pos, "multiple storage classes");
 
 		ctype->modifiers = old | mod | extra;
 	}
 
 	/* Context mask and value */
 	if ((ctype->context ^ thistype->context) & (ctype->contextmask & \
                thistype->contextmask)) {
-		warning(pos, "inconsistent attribute types");
+		error(pos, "inconsistent attribute types");
 		thistype->context = 0;
 		thistype->contextmask = 0;
 	}
@@ -471,7 +471,7 @@
 
 	/* Alignment */
 	if (thistype->alignment & (thistype->alignment-1)) {
-		warning(pos, "I don't like non-power-of-2 alignments");
+		error(pos, "I don't like non-power-of-2 alignments");
 		thistype->alignment = 0;
 	}
 	if (thistype->alignment > ctype->alignment)
@@ -506,8 +506,8 @@
 
 	wrong = mod & banned;
 	if (wrong)
-		warning(*pos, "modifier %sis invalid in this context",
-		     modifier_string (wrong));
+		error(*pos, "modifier %sis invalid in this context",
+		      modifier_string (wrong));
 }
 
 
@@ -588,7 +588,7 @@
 		struct symbol *type;
 		ctype->modifiers &= ~(MOD_BITWISE | MOD_SPECIFIER);
 		if (!is_int_type(ctype->base_type)) {
-			warning(token->pos, "invalid modifier");
+			error(token->pos, "invalid modifier");
 			return token;
 		}
 		type = alloc_symbol(token->pos, SYM_BASETYPE);
@@ -724,7 +724,7 @@
 	long long width;
 
 	if (!is_int_type(ctype->base_type)) {
-		warning(token->pos, "invalid bitfield specifier for type %s.",
+		error(token->pos, "invalid bitfield specifier for type %s.",
 			show_typename(ctype->base_type));
 		// Parse this to recover gracefully.
 		return conditional_expression(token->next, &expr);
@@ -736,10 +736,10 @@
 	bitfield->fieldwidth = width;
 
 	if (width < 0) {
-		warning(token->pos, "invalid negative bitfield width, %lld.", width);
+		error(token->pos, "invalid negative bitfield width, %lld.", width);
 		bitfield->fieldwidth = 8;
 	} else if (decl->ident && width == 0) {
-		warning(token->pos, "invalid named zero-width bitfield `%s'",
+		error(token->pos, "invalid named zero-width bitfield `%s'",
 		     show_ident(decl->ident));
 		bitfield->fieldwidth = 8;
 	} else if (width != bitfield->fieldwidth) {
@@ -787,7 +787,7 @@
 			token = token->next;
 		}
 		if (!match_op(token, ';')) {
-			warning(token->pos, "expected ; at end of declaration");
+			error(token->pos, "expected ; at end of declaration");
 			break;
 		}
 		token = token->next;
@@ -1013,7 +1013,7 @@
 	struct symbol *sym;
 
 	if (!target) {
-		warning(stmt->pos, "not in switch scope");
+		error(stmt->pos, "not in switch scope");
 		return;
 	}
 	sym = alloc_symbol(stmt->pos, SYM_NODE);
@@ -1096,7 +1096,7 @@
 	if (token_type(token) == TOKEN_IDENT && token->ident == &while_ident)
 		token = token->next;
 	else
-		warning(token->pos, "expected 'while' after 'do'");
+		error(token->pos, "expected 'while' after 'do'");
 	token = parens_expression(token, &expr, "after 'do-while'");
 
 	stmt->iterator_post_condition = expr;
@@ -1131,7 +1131,7 @@
 			stmt->type = STMT_GOTO;
 			stmt->goto_label = target;
 			if (!target)
-				warning(stmt->pos, "break/continue not in iterator scope");
+				error(stmt->pos, "break/continue not in iterator scope");
 			return expect(token->next, ';', "at end of statement");
 		}
 		if (token->ident == &default_ident) {
@@ -1175,7 +1175,7 @@
 				stmt->goto_label = label_symbol(token);
 				token = token->next;
 			} else {
-				warning(token->pos, "Expected identifier or goto expression");
+				error(token->pos, "Expected identifier or goto expression");
 			}
 			return expect(token, ';', "at end of statement");
 		}
@@ -1233,7 +1233,7 @@
 
 		if (match_op(token, SPECIAL_ELLIPSIS)) {
 			if (!*list)
-				warning(token->pos, "variadic functions must have one named argument");
+				error(token->pos, "variadic functions must have one named argument");
 			fn->variadic = 1;
 			token = token->next;
 			break;
@@ -1245,7 +1245,7 @@
 			/* Special case: (void) */
 			if (!*list && !sym->ident)
 				break;
-			warning(token->pos, "void parameter");
+			error(token->pos, "void parameter");
 		}
 		add_symbol(list, sym);
 		if (!match_op(token, ','))
@@ -1284,7 +1284,7 @@
 	if (to) {
 		idx_to = get_expression_value(to);
 		if (idx_to < idx_from || idx_from < 0)
-			warning(from->pos, "nonsense array initializer index range");
+			error(from->pos, "nonsense array initializer index range");
 	}
 	expr->idx_from = idx_from;
 	expr->idx_to = idx_to;
@@ -1339,7 +1339,7 @@
 static void declare_argument(struct symbol *sym, struct symbol *fn)
 {
 	if (!sym->ident) {
-		warning(sym->pos, "no identifier for function argument");
+		error(sym->pos, "no identifier for function argument");
 		return;
 	}
 	bind_symbol(sym, sym->ident, NS_SYMBOL);
@@ -1417,7 +1417,7 @@
 			if (type->ident == arg->ident)
 				goto match;
 		} END_FOR_EACH_PTR(type);
-		warning(arg->pos, "missing type declaration for parameter '%s'", \
show_ident(arg->ident)); +		error(arg->pos, "missing type declaration for parameter \
'%s'", show_ident(arg->ident));  continue;
 match:
 		type->used = 1;
@@ -1429,7 +1429,7 @@
 
 	FOR_EACH_PTR(argtypes, arg) {
 		if (!arg->used)
-			warning(arg->pos, "nonsensical parameter declaration '%s'", \
show_ident(arg->ident)); +			error(arg->pos, "nonsensical parameter declaration \
'%s'", show_ident(arg->ident));  } END_FOR_EACH_PTR(arg);
 
 }
@@ -1447,7 +1447,7 @@
 	apply_k_r_types(args, decl);
 
 	if (!match_op(token, '{')) {
-		warning(token->pos, "expected function body");
+		error(token->pos, "expected function body");
 		return token;
 	}
 	return parse_function_body(token, decl, list);
@@ -1513,7 +1513,7 @@
 		if (!(decl->ctype.modifiers & MOD_STATIC))
 			decl->ctype.modifiers |= MOD_EXTERN;
 	} else if (!is_typedef && base_type == &void_ctype && !(decl->ctype.modifiers & \
                MOD_EXTERN)) {
-		warning(token->pos, "void declaration");
+		error(token->pos, "void declaration");
 	}
 
 	for (;;) {
@@ -1552,7 +1552,7 @@
 		token = declaration_specifiers(token, &decl->ctype, 1);
 		token = declarator(token, &decl, &ident);
 		if (!ident) {
-			warning(token->pos, "expected identifier name in type definition");
+			error(token->pos, "expected identifier name in type definition");
 			return token;
 		}
 
diff -Nru a/pre-process.c b/pre-process.c
--- a/pre-process.c	2004-09-13 16:29:46 -04:00
+++ b/pre-process.c	2004-09-13 16:29:46 -04:00
@@ -88,8 +88,7 @@
 static void replace_with_integer(struct token *token, unsigned int val)
 {
 	char *buf = __alloc_bytes(11);
-	// FIXME: to be signed or not to be
-	sprintf(buf, "%d", val);
+	sprintf(buf, "%u", val);
 	token_type(token) = TOKEN_NUMBER;
 	token->number = buf;
 }
diff -Nru a/pre-process.c b/pre-process.c
--- a/pre-process.c	2004-09-13 16:29:47 -04:00
+++ b/pre-process.c	2004-09-13 16:29:47 -04:00
@@ -87,7 +87,8 @@
 
 static void replace_with_integer(struct token *token, unsigned int val)
 {
-	char *buf = __alloc_bytes(10);
+	char *buf = __alloc_bytes(11);
+	// FIXME: to be signed or not to be
 	sprintf(buf, "%d", val);
 	token_type(token) = TOKEN_NUMBER;
 	token->number = buf;
-
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic