Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 May 2001 13:22:02 +0400 (MSD)
From:      avn@any.ru
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   misc/27492: syslog.h fails to compile with -Wwrite-strings
Message-ID:  <200105210922.f4L9M2S39752@ns.any.ru>

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

>Number:         27492
>Category:       misc
>Synopsis:       syslog.h fails to compile with -Wwrite-strings
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon May 21 02:30:02 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Alexey V. Neyman
>Release:        FreeBSD 4.3-STABLE
>Organization:
ANY.RU
>Environment:
FreeBSD srv2.any 4.3-STABLE FreeBSD 4.3-STABLE #2: Thu May 17 19:01:42 MSD 2001
    toor@srv2.any:/usr2/obj/usr2/src/sys/SRV2  i386
>Description:
>How-To-Repeat:
$cat > a.c
#define SYSLOG_NAMES
#include <stdio.h>
#include <syslog.h>
int main(void) {return 0;}
^D
$gcc -Wwrite-strings -Werror a.c
In file included from a.c:3:
/usr/include/syslog.h:76: warning: initialization discards qualifiers from point
er target type
[ ... many more warnings skipped ... ]
>Fix:

--- syslog.h.orig	Mon May 21 13:04:27 2001
+++ syslog.h	Mon May 21 13:05:19 2001
@@ -68,8 +68,8 @@
 				/* mark "facility" */
 #define	INTERNAL_MARK	LOG_MAKEPRI((LOG_NFACILITIES<<3), 0)
 typedef struct _code {
-	char	*c_name;
-	int	c_val;
+	const char	*c_name;
+	int		c_val;
 } CODE;
 
 CODE prioritynames[] = {
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




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