misc/172636: usr.bin/ar: mark bsdar_errc() as __noreturn__

Erik Cederstrand erik at cederstrand.dk
Fri Oct 12 11:40:01 UTC 2012


>Number:         172636
>Category:       misc
>Synopsis:       usr.bin/ar: mark bsdar_errc() as __noreturn__
>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 Oct 12 11:40:00 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Erik Cederstrand
>Release:        CURRENT
>Organization:
>Environment:
>Description:
ar(1) contains a custom error function that calls exit() unconditionally. The definition of this function in the ar.h header file does not mark this file as non-returning. Marking it as such helps compilers reason about code.

Example: http://scan.freebsd.your.org/freebsd-head/usr.bin.ar/2012-10-03-amd64/report-5ffw6K.html.gz#EndPath (false positive originating in step 31).
>How-To-Repeat:

>Fix:
See patch

Patch attached with submission follows:

Index: head/usr.bin/ar/ar.h
===================================================================
--- head/usr.bin/ar/ar.h	(revision 241438)
+++ head/usr.bin/ar/ar.h	(working copy)
@@ -111,7 +111,7 @@
 };
 
 void	bsdar_errc(struct bsdar *, int _eval, int _code,
-	    const char *fmt, ...);
+	    const char *fmt, ...) __attribute__ ((__noreturn__));
 void	bsdar_warnc(struct bsdar *, int _code, const char *fmt, ...);
 void	ar_mode_d(struct bsdar *bsdar);
 void	ar_mode_m(struct bsdar *bsdar);


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


More information about the freebsd-bugs mailing list