Skip site navigation (1)Skip section navigation (2)
Date:      Fri,  5 Sep 2003 17:09:35 +0200 (CEST)
From:      Stefan Farfeleder <stefan@fafoe.narf.at>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        stefan@fafoe.narf.at
Subject:   bin/56492: [patch] Removal of stray semicolons after functions in elfdump
Message-ID:  <20030905150935.2DEF8318@frog.fafoe.narf.at>
Resent-Message-ID: <200309051510.h85FADIX085599@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         56492
>Category:       bin
>Synopsis:       [patch] Removal of stray semicolons after functions in elfdump
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Sep 05 08:10:13 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Stefan Farfeleder
>Release:        FreeBSD 5.1-CURRENT i386
>Organization:
>Environment:
System: FreeBSD frog.fafoe.narf.at 5.1-CURRENT FreeBSD 5.1-CURRENT #6: Thu Aug 28 12:17:45 CEST 2003 freebsd@frog.fafoe.narf.at:/freebsd/frog/obj/freebsd/frog/src/sys/FROG i386


	
>Description:
In src/usr.bin/elfdump/elfdump.c three functions are terminated by a
semicolon.  But a semicolon after a function actually constitutes an emtpy
declaration which violates a constraint in C89 and C99.
	
>How-To-Repeat:
Compile it with a compliant compiler:

$ c89 -c elfdump.c
[...]
elfdump.c:241: warning: ISO C does not allow extra `;' outside of a function
[...]
$ tcc -Ysystem -c elfdump.c
"elfdump.c", line 243: Error:
  [ISO 6.5]: Can't have empty declaration.
[...]
	
>Fix:

	

--- elfdump.diff begins here ---
Index: src/usr.bin/elfdump/elfdump.c
===================================================================
RCS file: /usr/home/ncvs/src/usr.bin/elfdump/elfdump.c,v
retrieving revision 1.9
diff -u -r1.9 elfdump.c
--- src/usr.bin/elfdump/elfdump.c	9 Aug 2003 01:55:37 -0000	1.9
+++ src/usr.bin/elfdump/elfdump.c	5 Sep 2003 14:41:25 -0000
@@ -238,7 +238,7 @@
 	case 0x7fffffff: return "DT_SUNW_FILTER";
 	default: return "ERROR: TAG NOT DEFINED";
 	}
-};
+}
 
 static const char *
 e_machines(u_int mach)
@@ -256,7 +256,7 @@
 	case EM_IA_64:	return "EM_IA_64";
 	}
 	return "(unknown machine)";
-};
+}
 
 const char *e_types[] = {
 	"ET_NONE", "ET_REL", "ET_EXEC", "ET_DYN", "ET_CORE"
@@ -327,7 +327,7 @@
 	/* 0x80000000 - 0xffffffff application programs */
 	default: return "ERROR: SHT NOT DEFINED";
 	}
-};
+}
 
 const char *sh_flags[] = {
 	"", "SHF_WRITE", "SHF_ALLOC", "SHF_WRITE|SHF_ALLOC", "SHF_EXECINSTR",
--- elfdump.diff ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030905150935.2DEF8318>