浏览代码

remove ineffective compiler assist from printf

The switch statement has no 'default:' case and the function ends
immediately following the switch, so the extra comparison did not
communicate any extra information to the compiler.
Alexander Monakov 7 年之前
父节点
当前提交
2e6e08423b
共有 2 个文件被更改,包括 0 次插入4 次删除
  1. 0 2
      src/stdio/vfprintf.c
  2. 0 2
      src/stdio/vfwprintf.c

+ 0 - 2
src/stdio/vfprintf.c

@@ -107,8 +107,6 @@ union arg
 
 
 static void pop_arg(union arg *arg, int type, va_list *ap)
 static void pop_arg(union arg *arg, int type, va_list *ap)
 {
 {
-	/* Give the compiler a hint for optimizing the switch. */
-	if ((unsigned)type > MAXSTATE) return;
 	switch (type) {
 	switch (type) {
 	       case PTR:	arg->p = va_arg(*ap, void *);
 	       case PTR:	arg->p = va_arg(*ap, void *);
 	break; case INT:	arg->i = va_arg(*ap, int);
 	break; case INT:	arg->i = va_arg(*ap, int);

+ 0 - 2
src/stdio/vfwprintf.c

@@ -98,8 +98,6 @@ union arg
 
 
 static void pop_arg(union arg *arg, int type, va_list *ap)
 static void pop_arg(union arg *arg, int type, va_list *ap)
 {
 {
-	/* Give the compiler a hint for optimizing the switch. */
-	if ((unsigned)type > MAXSTATE) return;
 	switch (type) {
 	switch (type) {
 	       case PTR:	arg->p = va_arg(*ap, void *);
 	       case PTR:	arg->p = va_arg(*ap, void *);
 	break; case INT:	arg->i = va_arg(*ap, int);
 	break; case INT:	arg->i = va_arg(*ap, int);