kern/175759: Correct data types for fields of struct qm_trace{} from <sys/queue.h>

Andrey Simonenko simon at comsys.ntu-kpi.kiev.ua
Fri Feb 1 11:50:01 UTC 2013


>Number:         175759
>Category:       kern
>Synopsis:       Correct data types for fields of struct qm_trace{} from <sys/queue.h>
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Feb 01 11:50:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Andrey Simonenko
>Release:        FreeBSD 9.1-STABLE amd64
>Organization:
>Environment:
>Description:

If QUEUE_MACRO_DEBUG is defined and WARNS >= 4, then a program that
uses some macro definitions from <sys/queue.h> cannot be built because
of "warning: assignment discards qualifiers from pointer target type"
warnings.

1. File name fields should have "const char *" type.

2. Line number fields should have "long" or "unsigned long" type,
   considering C99 standard and its values for [U]INT_MAX, __LINE__
   and #line.

>How-To-Repeat:
>Fix:
--- queue.h.orig	2012-12-11 21:00:44.000000000 +0200
+++ queue.h	2013-01-31 13:37:13.000000000 +0200
@@ -105,10 +105,10 @@
 #ifdef QUEUE_MACRO_DEBUG
 /* Store the last 2 places the queue element or head was altered */
 struct qm_trace {
-	char * lastfile;
-	int lastline;
-	char * prevfile;
-	int prevline;
+	const char *lastfile;
+	unsigned long lastline;
+	const char *prevfile;
+	unsigned long prevline;
 };
 
 #define	TRACEBUF	struct qm_trace trace;

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


More information about the freebsd-bugs mailing list