Projects
home:lf14:branches:Mega:23.09
glibc
_service:tar_scm:backport-clang-0011-misc-Suppr...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:backport-clang-0011-misc-Suppress-clang-warnings-on-syslog.patch of Package glibc
From a0dd7c2e8c5c561d34f8ea58b9ad95e5f20329ee Mon Sep 17 00:00:00 2001 From: luofeng <luofeng13@huawei.com> Date: Thu, 11 Apr 2024 21:37:06 +0800 Subject: [PATCH] backport-clang-0011-misc-Suppress-clang-warnings-on-syslog --- misc/syslog.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/misc/syslog.c b/misc/syslog.c index 4af87f5..c92787e 100644 --- a/misc/syslog.c +++ b/misc/syslog.c @@ -31,6 +31,7 @@ static char sccsid[] = "@(#)syslog.c 8.4 (Berkeley) 3/18/94"; #endif /* LIBC_SCCS and not lint */ +#include <libc-diag.h> #include <libio/libioP.h> #include <paths.h> #include <stdarg.h> @@ -179,6 +180,10 @@ __vsyslog_internal (int pri, const char *fmt, va_list ap, #define SYSLOG_HEADER_WITHOUT_TS(__pri, __msgoff) \ "<%d>: %n", __pri, __msgoff + /* clang complains that adding a 'int_t' to a string does not append to it, + but the idea is to print the pid conditionally. */ + DIAG_PUSH_NEEDS_COMMENT_CLANG; + DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wstring-plus-int"); int l, vl; if (has_ts) l = __snprintf (bufs, sizeof bufs, @@ -186,6 +191,8 @@ __vsyslog_internal (int pri, const char *fmt, va_list ap, else l = __snprintf (bufs, sizeof bufs, SYSLOG_HEADER_WITHOUT_TS (pri, &msgoff)); + DIAG_POP_NEEDS_COMMENT_CLANG; + if (l < 0) goto out; @@ -238,6 +245,8 @@ __vsyslog_internal (int pri, const char *fmt, va_list ap, clarg.buf = buf; int cl; + DIAG_PUSH_NEEDS_COMMENT_CLANG; + DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wstring-plus-int"); if (has_ts) cl = __snprintf (buf, l + 1, SYSLOG_HEADER (pri, timestamp, &msgoff, pid)); @@ -252,7 +261,7 @@ __vsyslog_internal (int pri, const char *fmt, va_list ap, cl = __vsnprintf_internal (buf + l, bufsize - l + 1, fmt, apc, mode_flags); va_end (apc); - + DIAG_POP_NEEDS_COMMENT_CLANG; if (cl != vl) goto out; } @@ -273,8 +282,13 @@ __vsyslog_internal (int pri, const char *fmt, va_list ap, /* Output to stderr if requested. */ if (LogStat & LOG_PERROR) - __dprintf (STDERR_FILENO, "%s%s", buf + msgoff, - "\n" + (buf[bufsize - 1] == '\n')); + { + DIAG_PUSH_NEEDS_COMMENT_CLANG; + DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wstring-plus-int"); + __dprintf (STDERR_FILENO, "%s%s", buf + msgoff, + "\n" + (buf[bufsize - 1] == '\n')); + DIAG_POP_NEEDS_COMMENT_CLANG; + } /* Get connected, output the message to the local logger. */ if (!connected) -- 2.19.1
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2