From patchwork Tue May 14 21:31:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Sebor X-Patchwork-Id: 1099736 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-500688-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="DBBbdJsu"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="VETl6OT0"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 453W9h21Sfz9sNd for ; Wed, 15 May 2019 07:32:24 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :subject:to:message-id:date:mime-version:content-type; q=dns; s= default; b=TSLKjx+tcu6ThsYuoTN+mFizPmh8ScAtRFvq/bDg6coJ4uTF6Y6jZ ZQYESEO/ejdDbQCLw22m1Z0G1bs93D26QxWeB+V1whg3YcBa4PyFyey5jIxyvl69 aVkQWuG4HahVrS/JSfbJXjdKh+urj9yNPCMzGaUxCRLiLViyOMkI4c= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :subject:to:message-id:date:mime-version:content-type; s= default; bh=sjTGXaDN++jIRqdOIIweb6UFJU4=; b=DBBbdJsumOQ5UGqO8Xqv TsGRKlFRzG3+/YcTkqcOA4BBeHXANB/x7NkPjqBrRfjiSTLSLpG1ApYoc8KENidD qCzpG+fPX6FKFjETcZqvyjsxt9G0byuEiZnUtxQWrpsehFiuwz1iVbhUTxGeoky6 VM25JMQ1HuPqTQwUd8IAopo= Received: (qmail 36431 invoked by alias); 14 May 2019 21:32:03 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 36319 invoked by uid 89); 14 May 2019 21:32:03 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-16.9 required=5.0 tests=AWL, BAYES_00, FILL_THIS_FORM, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS, T_FILL_THIS_FORM_LONG autolearn=ham version=3.3.1 spammy=pound, substrings, bare, Quote X-HELO: mail-qt1-f174.google.com Received: from mail-qt1-f174.google.com (HELO mail-qt1-f174.google.com) (209.85.160.174) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 14 May 2019 21:31:54 +0000 Received: by mail-qt1-f174.google.com with SMTP id o7so883380qtp.4 for ; Tue, 14 May 2019 14:31:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:to:message-id:date:user-agent:mime-version :content-language; bh=ECXEup5tS+l6a5vBHnIfmsZkqCq3Y+8r8NDxBWFXeho=; b=VETl6OT0MCuagNJb3H75ODDWRqR8uiNJ7Hd1fo3fkk3UR06hEO/QHjUn0nPW+VGFyb bMG52kNkj/FsexrXZ3L4YmjBE3/LadXda4vRoeDHa2ZE8fpU4lV6I2EDG6D17ACZzZ90 MCG6RIS/e1+yCmSIs0YC4stjDrlSbCCY886AzRGnCFsB6OlyZQtCmkqkhFB4mVvrAlJd LOl0+0xBn/D+/yz4YQEkwf8zmnDAWgUQ6hahoVMEFj2YsXWNNAwenHa3czo4mgAiI9KR Or7Sput7EQwF9ikyjULMHNK1ZRD8ik24W3GJTSvtt7hGWjDspgZJaW6diPd3m+TopqUM bobw== Received: from [192.168.0.41] (97-118-125-210.hlrn.qwest.net. [97.118.125.210]) by smtp.gmail.com with ESMTPSA id e37sm121686qte.23.2019.05.14.14.31.50 for (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Tue, 14 May 2019 14:31:51 -0700 (PDT) From: Martin Sebor Subject: [PATCH 1/12] implement -Wformat-diag to detect quoting and spelling issues in GCC diagnostics To: gcc-patches Message-ID: Date: Tue, 14 May 2019 15:31:50 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 MIME-Version: 1.0 X-IsSubscribed: yes The attached patch implements the -Wformat-diag warning to help find quoting, spelling, and other formatting issues in diagnostics issued by GCC. Martin gcc/c-family/ChangeLog: * c-common.h (GCC_DIAG_STYLE): Adjust. (GCC_DIAG_RAW_STYLE): New macro. c-format.c (function_format_info::format_type): Adjust type. (function_format_info::is_raw): New member. (decode_format_type): Adjust signature. Handle "raw" diag attributes. (decode_format_attr): Adjust call to decode_format_type. Avoid a redundant call to convert_format_name_to_system_name. Avoid abbreviating the word "arguments" in a diagnostic. (format_warning_substr): New function. (avoid_dollar_number): Quote dollar sign in a diagnostic. (finish_dollar_format_checking): Same. (check_format_info): Same. (struct baltoks_t): New. (maybe_diag_unbalanced_tokens, check_tokens, check_plain): New functions. (check_format_info_main): Call check_plain. Use baltoks_t. Call maybe_diag_unbalanced_tokens. (handle_format_attribute): Spell out the word "arguments" in a diagnostic. * c.opt (-Wformat-diag): New option. gcc/testsuite/ChangeLog: * gcc.dg/format/gcc_diag-11.c: New test. diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h index 1cf2cae6395..9d067028416 100644 --- a/gcc/c-family/c-common.h +++ b/gcc/c-family/c-common.h @@ -39,7 +39,10 @@ framework extensions, you must include this file before diagnostic-core.h \ never after. #endif #ifndef GCC_DIAG_STYLE -#define GCC_DIAG_STYLE __gcc_cdiag__ +# define GCC_DIAG_STYLE __gcc_cdiag__ +#endif +#ifndef GCC_DIAG_RAW_STYLE +# define GCC_DIAG_RAW_STYLE __gcc_cdiag_raw__ #endif #include "diagnostic-core.h" diff --git a/gcc/c-family/c-format.c b/gcc/c-family/c-format.c index a7f76c1c01d..372ab124661 100644 --- a/gcc/c-family/c-format.c +++ b/gcc/c-family/c-format.c @@ -52,7 +52,13 @@ enum format_type { printf_format_type, asm_fprintf_format_type, struct function_format_info { - int format_type; /* type of format (printf, scanf, etc.) */ + enum format_type format_type; /* type of format (printf, scanf, etc.) */ + /* IS_RAW is relevant only for GCC diagnostic format functions. + It is set for "raw" formatting functions like pp_printf that + are not intended to produce complete diagnostics according to + GCC guidelines, and clear for others like error and warning + whose format string is checked for proper quoting and spelling. */ + bool is_raw; unsigned HOST_WIDE_INT format_num; /* number of format argument */ unsigned HOST_WIDE_INT first_arg_num; /* number of first arg (zero for varargs) */ }; @@ -65,7 +71,7 @@ static GTY(()) tree locus; static bool decode_format_attr (const_tree, tree, tree, function_format_info *, bool); -static int decode_format_type (const char *); +static format_type decode_format_type (const char *, bool * = NULL); static bool check_format_string (const_tree argument, unsigned HOST_WIDE_INT format_num, @@ -111,6 +117,32 @@ format_warning_at_char (location_t fmt_string_loc, tree format_string_cst, return warned; } + +/* Emit a warning as per format_warning_va, but construct the substring_loc + for the substring at offset (POS1, POS2 - 1) within a string constant + FORMAT_STRING_CST at FMT_STRING_LOC. */ + +ATTRIBUTE_GCC_DIAG (6,7) +static bool +format_warning_substr (location_t fmt_string_loc, tree format_string_cst, + int pos1, int pos2, int opt, const char *gmsgid, ...) +{ + va_list ap; + va_start (ap, gmsgid); + tree string_type = TREE_TYPE (format_string_cst); + + pos2 -= 1; + + substring_loc fmt_loc (fmt_string_loc, string_type, pos1, pos1, pos2); + format_string_diagnostic_t diag (fmt_loc, NULL, UNKNOWN_LOCATION, NULL, + NULL); + bool warned = diag.emit_warning_va (opt, gmsgid, &ap); + va_end (ap); + + return warned; +} + + /* Check that we have a pointer to a string suitable for use as a format. The default is to check for a char type. For objective-c dialects, this is extended to include references to string @@ -320,10 +352,8 @@ decode_format_attr (const_tree fntype, tree atname, tree args, { const char *p = IDENTIFIER_POINTER (format_type_id); - p = convert_format_name_to_system_name (p); + info->format_type = decode_format_type (p, &info->is_raw); - info->format_type = decode_format_type (p); - if (!c_dialect_objc () && info->format_type == gcc_objc_string_format_type) { @@ -359,7 +389,7 @@ decode_format_attr (const_tree fntype, tree atname, tree args, if (info->first_arg_num != 0 && info->first_arg_num <= info->format_num) { gcc_assert (!validated_p); - error ("format string argument follows the args to be formatted"); + error ("format string argument follows the arguments to be formatted"); return false; } @@ -1067,27 +1097,55 @@ static void format_type_warning (const substring_loc &fmt_loc, char conversion_char); /* Decode a format type from a string, returning the type, or - format_type_error if not valid, in which case the caller should print an - error message. */ -static int -decode_format_type (const char *s) + format_type_error if not valid, in which case the caller should + print an error message. On success, when IS_RAW is non-null, set + *IS_RAW when the format type corresponds to a GCC "raw" diagnostic + formatting function and clear it otherwise. */ +static format_type +decode_format_type (const char *s, bool *is_raw /* = NULL */) { - int i; - int slen; + bool is_raw_buf; + + if (!is_raw) + is_raw = &is_raw_buf; + + *is_raw = false; s = convert_format_name_to_system_name (s); - slen = strlen (s); - for (i = 0; i < n_format_types; i++) + + size_t slen = strlen (s); + for (int i = 0; i < n_format_types; i++) { - int alen; + /* Check for a match with no underscores. */ if (!strcmp (s, format_types[i].name)) - return i; - alen = strlen (format_types[i].name); + return static_cast (i); + + /* Check for leading and trailing underscores. */ + size_t alen = strlen (format_types[i].name); if (slen == alen + 4 && s[0] == '_' && s[1] == '_' && s[slen - 1] == '_' && s[slen - 2] == '_' && !strncmp (s + 2, format_types[i].name, alen)) - return i; + return static_cast(i); + + /* Check for the "_raw" suffix and no leading underscores. */ + if (slen == alen + 4 + && !strncmp (s, format_types[i].name, alen) + && !strcmp (s + alen, "_raw")) + { + *is_raw = true; + return static_cast(i); + } + + /* Check for the "_raw__" suffix and leading underscores. */ + if (slen == alen + 8 && s[0] == '_' && s[1] == '_' + && !strncmp (s + 2, format_types[i].name, alen) + && !strcmp (s + 2 + alen, "_raw__")) + { + *is_raw = true; + return static_cast(i); + } } + return format_type_error; } @@ -1350,7 +1408,8 @@ avoid_dollar_number (const char *format) format++; if (*format == '$') { - warning (OPT_Wformat_, "$ operand number used after format without operand number"); + warning (OPT_Wformat_, + "%<$%>operand number used after format without operand number"); return true; } return false; @@ -1381,7 +1440,8 @@ finish_dollar_format_checking (format_check_results *res, int pointer_gap_ok) found_pointer_gap = true; else warning_at (res->format_string_loc, OPT_Wformat_, - "format argument %d unused before used argument %d in $-style format", + "format argument %d unused before used argument %d " + "in %<$%>-style format", i + 1, dollar_max_arg_used); } } @@ -1525,7 +1585,8 @@ check_format_info (function_format_info *info, tree params, } if (res.number_dollar_extra_args > 0 && res.number_non_literal == 0 && res.number_other == 0) - warning_at (loc, OPT_Wformat_extra_args, "unused arguments in $-style format"); + warning_at (loc, OPT_Wformat_extra_args, + "unused arguments in %<$%>-style format"); if (res.number_empty > 0 && res.number_non_literal == 0 && res.number_other == 0) warning_at (loc, OPT_Wformat_zero_length, "zero-length %s format string", @@ -2789,6 +2850,862 @@ check_argument_type (const format_char_info *fci, return true; } +/* Describes "paired tokens" within the format string that are + expected to be balanced. */ + +struct baltoks_t +{ + baltoks_t (): singlequote (), doublequote () { } + + typedef auto_vec balanced_tokens_t; + /* Vectors of pointers to opening opening brackets ('['), curly + brackets ('{'), quoting directives (like GCC "%<"), parentheses, + and angle brackets ('<'). Used to detect unbalanced tokens. */ + balanced_tokens_t brackets; + balanced_tokens_t curly; + balanced_tokens_t quotdirs; + balanced_tokens_t parens; + balanced_tokens_t pointy; + /* Pointer to the last opening quote. */ + const char *singlequote; + const char *doublequote; +}; + +/* Describes a keyword, operator, or other name. */ + +struct token_t +{ + const char *name; /* Keyword/operator name. */ + unsigned char len; /* Its length. */ + bool is_cxx; /* Set for C++ only names. */ +}; + +/* C/C++ operators that are expected to be quoted within the format + string. */ + +static const token_t opers[] = + { +#undef NAME +#define NAME(name) { name, sizeof name - 1, false } + + NAME ("=="), NAME ("!="), NAME (">="), NAME ("<="), NAME ("->"), + NAME ("++"), NAME ("--"), NAME ("&&"), NAME ("||"), NAME ("?:"), + NAME ("*="), NAME ("/="), NAME ("%="), NAME ("+="), NAME ("-="), + NAME ("&="), NAME ("^="), NAME ("|="), NAME ("<<="), NAME (">>="), + +#undef NAME +#define NAME(name) { name, sizeof name - 1, true } + NAME (".*"), + NAME ("->*"), + NAME ("::"), + NAME ("<=>") + }; + +/* Common C/C++ keywords that are expected to be quoted within the format + string. Keywords like auto, inline, or volatile are exccluded because + they are sometimes used in common terms like /auto variables/, /inline + function/, or /volatile access/ where they should not be quoted. */ + +static const token_t keywords[] = + { +#undef NAME +#define NAME(name) { name, sizeof name - 1, false } + NAME ("alignas"), + NAME ("alignof"), + NAME ("asm"), + NAME ("bool"), + NAME ("char"), + NAME ("float"), + NAME ("int"), + NAME ("long double"), + NAME ("long int"), + NAME ("long long"), + NAME ("noreturn"), + NAME ("offsetof"), + NAME ("short int"), + NAME ("signed char"), + NAME ("signed int"), + NAME ("signed short"), + NAME ("signed long"), + NAME ("unsigned char"), + NAME ("unsigned int"), + NAME ("unsigned short"), + NAME ("unsigned long"), + NAME ("sizeof"), + NAME ("typeof"), + NAME ("wchar_t"), + +#undef NAME +#define NAME(name) { name, sizeof name - 1, true } + + /* C++ only keywords and operators. */ + NAME ("char8_t"), + NAME ("char16_t"), + NAME ("char32_t"), + NAME ("catch"), + NAME ("constexpr if"), + NAME ("constexpr"), + NAME ("consteval"), + NAME ("decltype"), + NAME ("nullptr"), + NAME ("operator delete"), + NAME ("operator new"), + NAME ("typeid"), + NAME ("typeinfo") + +#undef NAME + }; + +/* Common contractions that should be avoided in favor of alternatives. */ + +static const struct +{ + const char *name; /* Contraction. */ + unsigned char len; /* Its length. */ + const char *alt; /* Preferred alternative. */ +} contrs[] = + { +#define CONTR(name, alt) { name, sizeof name - 1, alt } + + CONTR ("can't", "cannot"), + CONTR ("didn't", "did not"), + /* These are commonly abused. Avoid diagnosing them for now. + CONTR ("isn't", "is not"), + CONTR ("don't", "is not"), + */ + CONTR ("mustn't", "must not"), + CONTR ("needn't", "need not"), + CONTR ("should't", "should not"), + CONTR ("that's", "that is"), + CONTR ("there's", "there is"), + CONTR ("they're", "they are"), + CONTR ("what's", "what is"), + CONTR ("won't", "will not") + }; + +/* Check for unquoted TOKENS. FORMAT_STRING_LOC is the location of + the format string, FORMAT_STRING_CST the format string itself (as + a tree), ORIG_FORMAT_CHARS and FORMAT_CHARS are ponters to + the beginning of the format string and the character currently + being processed, and BALTOKS describes paired "tokens" within + the format string that are expected to be balanced. + Returns a pointer to the last processed character or null when + nothing was done. */ + +static const char* +check_tokens (const token_t *tokens, unsigned ntoks, + location_t format_string_loc, tree format_string_cst, + const char *orig_format_chars, const char *format_chars, + baltoks_t &baltoks) +{ + /* For brevity. */ + const int opt = OPT_Wformat_diag; + /* Zero-based starting position of a problem sequence. */ + int fmtchrpos = format_chars - orig_format_chars; + + /* For identifier-like "words," set to the word length. */ + unsigned wlen = 0; + /* Set for an operator, clear for an identifier/word. */ + bool is_oper = false; + bool underscore = false; + + if (format_chars[0] == '_' || ISALPHA (format_chars[0])) + { + while (format_chars[wlen] == '_' || ISALNUM (format_chars[wlen])) + { + underscore |= format_chars[wlen] == '_'; + ++wlen; + } + } + else + is_oper = true; + + bool is_cxx = c_dialect_cxx (); + + for (unsigned i = 0; i != ntoks; ++i) + { + unsigned toklen = tokens[i].len; + + if ((!is_cxx && tokens[i].is_cxx) + || toklen < wlen + || strncmp (format_chars, tokens[i].name, toklen)) + continue; + + if (toklen == 2 + && format_chars - orig_format_chars > 0 + && (TOUPPER (format_chars[-1]) == 'C' + || TOUPPER (format_chars[-1]) == 'G')) + return format_chars + toklen - 1; /* Reference to C++ or G++. */ + + if (ISPUNCT (format_chars[toklen - 1])) + { + if (format_chars[toklen - 1] == format_chars[toklen]) + return NULL; /* Operator followed by another punctuator. */ + } + else if (ISALNUM (format_chars[toklen])) + return NULL; /* Keyword prefix for a longer word. */ + + if (toklen == 2 + && format_chars[0] == '-' + && format_chars[1] == '-' + && ISALNUM (format_chars[2])) + return NULL; /* Probably option like --help. */ + + /* Allow this ugly warning for the time being. */ + if (toklen == 2 + && format_chars - orig_format_chars > 6 + && !strncmp (format_chars - 7, " count >= width of ", 19)) + return format_chars + 10; + + bool is_type = strchr (tokens[i].name, ' '); + format_warning_substr (format_string_loc, format_string_cst, + fmtchrpos, fmtchrpos + toklen, opt, + (is_type + ? G_("unquoted type name %<%.*s%> in format") + : (is_oper + ? G_("unquoted operator %<%.*s%> in format") + : G_("unquoted keyword %<%.*s%> in format"))), + toklen, format_chars); + return format_chars + toklen - 1; + } + + /* Diagnose unquoted __attribute__. Consider any parenthesized + argument to the attribute to avoid redundant warnings for + the double parentheses that might follow. */ + if (!strncmp (format_chars, "__attribute", sizeof "__attribute" - 1)) + { + unsigned nchars = sizeof "__attribute" - 1; + while ('_' == format_chars[nchars]) + ++nchars; + + for (int i = nchars; format_chars[i]; ++i) + if (' ' != format_chars[i]) + { + nchars = i; + break; + } + + if (format_chars[nchars] == '(') + { + baltoks.parens.safe_push (format_chars + nchars); + + ++nchars; + bool close = false; + if (format_chars[nchars] == '(') + { + baltoks.parens.safe_push (format_chars + nchars); + close = true; + ++nchars; + } + for (int i = nchars; format_chars[i]; ++i) + if (')' == format_chars[i]) + { + if (baltoks.parens.length () > 0) + baltoks.parens.pop (); + nchars = i + 1; + break; + } + + if (close && format_chars[nchars] == ')') + { + if (baltoks.parens.length () > 0) + baltoks.parens.pop (); + ++nchars; + } + } + + format_warning_substr (format_string_loc, format_string_cst, + fmtchrpos, fmtchrpos + nchars, opt, + "unquoted attribute in format"); + return format_chars + nchars - 1; + } + + /* Diagnose unquoted built-ins. */ + if (format_chars[0] == '_' + && format_chars[1] == '_' + && (!strncmp (format_chars + 2, "atomic", sizeof "atomic" - 1) + || !strncmp (format_chars + 2, "builtin", sizeof "builtin" - 1) + || !strncmp (format_chars + 2, "sync", sizeof "sync" - 1))) + { + format_warning_substr (format_string_loc, format_string_cst, + fmtchrpos, fmtchrpos + wlen, opt, + "unquoted name of built-in function %<%.*s%> " + "in format", + wlen, format_chars); + return format_chars + wlen - 1; + } + + /* Diagnose unquoted substrings of alphanumeric characters containing + underscores. They most likely refer to identifiers and should be + quoted. */ + if (underscore) + format_warning_substr (format_string_loc, format_string_cst, + format_chars - orig_format_chars, + format_chars + wlen - orig_format_chars, + opt, + "unquoted identifier or keyword %<%.*s%> in format", + wlen, format_chars); + else + { + /* Diagnose "can not". */ + if ((format_chars == orig_format_chars + || (format_chars - orig_format_chars + && !ISALNUM (format_chars[-1]))) + && !ISALNUM (format_chars[7]) + && !strncmp (format_chars, "can not", 7)) + { + format_warning_substr (format_string_loc, format_string_cst, + fmtchrpos, fmtchrpos + 7, opt, + "%qs is not a word; use %qs instead", + "can not", "cannot"); + return format_chars + 6; + } + + /* Diagnose "arg" (short for "argument" when lazy). */ + if (!strncmp (format_chars, "arg", 3) + && (!format_chars[3] + || format_chars[3] == 's' + || ISSPACE (format_chars[3]))) + { + int n = 3 + (format_chars[3] == 's'); + format_warning_substr (format_string_loc, format_string_cst, + fmtchrpos, fmtchrpos + n, opt, + "%q.*s is not a word; use %q.*s instead", + n, format_chars, + n == 3 ? 8 : 9, "arguments"); + return format_chars + n - 1; + } + + /* Diagnose "reg" (short for "register"). */ + if (!strncmp (format_chars, "reg", 3) + && (!format_chars[3] + || format_chars[3] == 's' + || ISSPACE (format_chars[3]))) + { + int n = 3 + (format_chars[3] == 's'); + format_warning_substr (format_string_loc, format_string_cst, + fmtchrpos, fmtchrpos + n, opt, + "%q.*s is not a word; use %q.*s instead", + n, format_chars, + n == 3 ? 8 : 9, "registers"); + return format_chars + n - 1; + } + } + + return wlen ? format_chars + wlen - 1 : NULL; +} + +/* Check plain text in a format string of a GCC diagnostic function + for common quoting, punctuation, and spelling mistakes, and issue + -Wformat-diag warnings if they are found. FORMAT_STRING_LOC is + the location of the format string, FORMAT_STRING_CST the format + string itself (as a tree), ORIG_FORMAT_CHARS and FORMAT_CHARS are + ponters to the beginning of the format string and the character + currently being processed, and BALTOKS describes paired "tokens" + within the format string that are expected to be balanced. + Returns a pointer to the last processed character. */ + +static const char* +check_plain (location_t format_string_loc, tree format_string_cst, + const char *orig_format_chars, const char *format_chars, + baltoks_t &baltoks) +{ + /* For brevity. */ + const int opt = OPT_Wformat_diag; + /* Zero-based starting position of a problem sequence. */ + int fmtchrpos = format_chars - orig_format_chars; + + if (*format_chars == '%') + { + /* Diagnose %<%s%> and suggest using %qs instead. */ + if (!strncmp (format_chars, "%<%s%>", 6) + && format_warning_substr (format_string_loc, format_string_cst, + fmtchrpos, fmtchrpos + 6, opt, + "quoted %qs directive in format", "%s")) + inform (format_string_loc, "use %qs instead", "%qs"); + + return format_chars; + } + + if (baltoks.quotdirs.length ()) + { + /* Skip over all plain text within a quoting directive until + the next directive. */ + while (*format_chars && '%' != *format_chars) + ++format_chars; + + return format_chars; + } + + /* The length of the problem sequence. */ + int nchars = 0; + + /* Diagnose any whitespace characters other than but only + leading, trailing, and two or more consecutive s. Do + this before diagnosing control characters because whitespace + is a subset of controls. */ + const char *other_than_space = NULL; + while (ISSPACE (format_chars[nchars])) + { + if (format_chars[nchars] != ' ' && !other_than_space) + other_than_space = format_chars + nchars; + ++nchars; + } + + if (nchars) + { + /* This is the most common problem: go the extra mile to decribe + the problem in as much helpful detail as possible. */ + if (other_than_space) + { + format_warning_substr (format_string_loc, format_string_cst, + fmtchrpos, fmtchrpos + nchars, opt, + "unquoted whitespace character %qc in format", + *other_than_space); + return format_chars + nchars - 1; + } + + if (fmtchrpos == 0) + /* Accept strings of leading spaces with no warning. */ + return format_chars + nchars - 1; + + if (!format_chars[nchars]) + { + format_warning_substr (format_string_loc, format_string_cst, + fmtchrpos, fmtchrpos + nchars, opt, + (nchars > 1 + ? G_("spurious trailing space characters " + "in format") + : G_("spurious trailing space character " + "in format"))); + return format_chars + nchars - 1; + } + + if (nchars > 1) + { + if (nchars == 2 + && orig_format_chars < format_chars + && format_chars[-1] == '.' + && format_chars[0] == ' ' + && format_chars[1] == ' ') + { + /* A period followed by two spaces. */ + if (ISUPPER (*orig_format_chars)) + { + /* If the part before the period is a capitalized + sentence check to make sure that what follows + is also capitalized. */ + if (ISLOWER (format_chars[2])) + format_warning_substr (format_string_loc, format_string_cst, + fmtchrpos, fmtchrpos + nchars, opt, + "inconsistent capitalization in " + "format"); + } + } + else + format_warning_substr (format_string_loc, format_string_cst, + fmtchrpos, fmtchrpos + nchars, opt, + "unquoted sequence of %i consecutive " + "space characters in format", nchars); + return format_chars + nchars - 1; + } + + format_chars += nchars; + nchars = 0; + } + + fmtchrpos = format_chars - orig_format_chars; + + /* Diagnose any unquoted control characters other than the terminating + NUL. */ + while (format_chars[nchars] && ISCNTRL (format_chars[nchars])) + ++nchars; + + if (nchars > 1) + { + format_warning_substr (format_string_loc, format_string_cst, + fmtchrpos, fmtchrpos + nchars, opt, + "unquoted control characters in format"); + return format_chars + nchars - 1; + } + if (nchars) + { + format_warning_substr (format_string_loc, format_string_cst, + fmtchrpos, fmtchrpos + nchars, opt, + "unquoted control character %qc in format", + *format_chars); + return format_chars + nchars - 1; + } + + if (ISPUNCT (format_chars[0])) + if (const char *ret = check_tokens (opers, + sizeof opers / sizeof *opers, + format_string_loc, format_string_cst, + orig_format_chars, format_chars, + baltoks)) + return ret; + + if (ISALPHA (format_chars[0])) + { + if (const char *ret = check_tokens (keywords, + sizeof keywords / sizeof *keywords, + format_string_loc, format_string_cst, + orig_format_chars, format_chars, + baltoks)) + return ret; + } + + nchars = 0; + + /* Diagnose unquoted options. */ + if ((format_chars == orig_format_chars + || format_chars[-1] == ' ') + && format_chars[0] == '-' + && ((format_chars[1] == '-' + && ISALPHA (format_chars[2])) + || ISALPHA (format_chars[1]))) + { + nchars = 1; + while (ISALNUM (format_chars[nchars]) + || '_' == format_chars[nchars] + || '-' == format_chars[nchars] + || '+' == format_chars[nchars]) + ++nchars; + + format_warning_substr (format_string_loc, format_string_cst, + fmtchrpos, fmtchrpos + nchars, opt, + "unquoted option name %<%.*s%> in format", + nchars, format_chars); + return format_chars + nchars - 1; + } + + /* Diagnose leading, trailing, and two or more consecutive punctuation + characters. */ + const char *unbalanced = NULL; + while ('%' != format_chars[nchars] + && ISPUNCT (format_chars[nchars]) + && !unbalanced) + { + switch (format_chars[nchars]) + { + case '[': + baltoks.brackets.safe_push (format_chars + nchars); + break; + case '{': + baltoks.curly.safe_push (format_chars + nchars); + break; + case '(': + baltoks.parens.safe_push (format_chars + nchars); + break; + case '<': + baltoks.pointy.safe_push (format_chars + nchars); + break; + + case ']': + if (baltoks.brackets.length () > 0) + baltoks.brackets.pop (); + else + unbalanced = format_chars + nchars; + break; + case '}': + if (baltoks.curly.length () > 0) + baltoks.curly.pop (); + else + unbalanced = format_chars + nchars; + break; + case ')': + if (baltoks.parens.length () > 0) + baltoks.parens.pop (); + else + unbalanced = format_chars + nchars; + break; + case '>': + if (baltoks.pointy.length () > 0) + baltoks.pointy.pop (); + else + unbalanced = format_chars + nchars; + break; + } + + ++nchars; + } + + if (unbalanced) + { + format_warning_substr (format_string_loc, format_string_cst, + fmtchrpos, fmtchrpos + nchars, opt, + "unbalanced punctuation character %qc in format", + *unbalanced); + return format_chars + nchars - 1; + } + + if (nchars) + { + /* Consider any identifier that follows the pound ('#') sign + a preprocessing drective. */ + if (nchars == 1 + && format_chars[0] == '#' + && ISALPHA (format_chars[1])) + { + while (ISALNUM (format_chars[nchars]) + || format_chars[nchars] == '_') + ++nchars; + + format_warning_substr (format_string_loc, format_string_cst, + fmtchrpos, fmtchrpos + nchars, opt, + "unquoted preprocessing directive %<%.*s%> " + "in format", nchars, format_chars); + return format_chars + nchars - 1; + } + + /* Diagnose a bare single quote. */ + if (nchars == 1 + && format_chars[0] == '\'' + && format_chars - orig_format_chars + && ISALPHA (format_chars[-1]) + && ISALPHA (format_chars[1])) + { + /* Diagnose a subset of contractions that are best avoided. */ + for (unsigned i = 0; i != sizeof contrs / sizeof *contrs; ++i) + { + const char *apos = strchr (contrs[i].name, '\''); + gcc_checking_assert (apos); + + int apoff = apos - contrs[i].name; + if (format_chars - orig_format_chars >= apoff + && !strncmp (format_chars - apoff, + contrs[i].name, contrs[i].len)) + { + if (format_warning_substr (format_string_loc, + format_string_cst, + fmtchrpos, fmtchrpos + nchars, opt, + "contraction %<%.*s%> in format", + contrs[i].len, contrs[i].name)) + inform (format_string_loc, + "use %qs instead", contrs[i].alt); + return format_chars + nchars - 1; + } + } + + if (format_warning_substr (format_string_loc, format_string_cst, + fmtchrpos, fmtchrpos + nchars, opt, + "bare apostrophe %<'%> in format")) + inform (format_string_loc, + "if avoiding the apostrophe is not feasible, enclose " + "it in a pair of %qs and %qs directives instead", + "%<", "%>"); + return format_chars + nchars - 1; + } + + /* Diagnose a backtick (grave accent). */ + if (nchars == 1 + && format_chars[0] == '`') + { + format_warning_substr (format_string_loc, format_string_cst, + fmtchrpos, fmtchrpos + nchars, opt, + "grave accent %<`%> in format"); + return format_chars + nchars - 1; + } + + /* Diagnose a punctuation character after a space. */ + if (nchars == 1 + && format_chars - orig_format_chars + && format_chars[-1] == ' ' + && strspn (format_chars, "!?:;.,") == 1) + { + format_warning_substr (format_string_loc, format_string_cst, + fmtchrpos - 1, fmtchrpos, opt, + "space followed by punctuation character " + "%<%c%>", format_chars[0]); + return format_chars; + } + + if (nchars == 1) + { + if (!strncmp (format_chars, "\"%s\"", 4)) + { + if (format_warning_substr (format_string_loc, format_string_cst, + fmtchrpos, fmtchrpos + 4, opt, + "quoted %qs directive in format", + "%s")) + inform (format_string_loc, "if using %qs is not feasible, " + "use %qs instead", "%qs", "\"%-s\""); + } + + if (format_chars[0] == '"') + { + baltoks.doublequote = baltoks.doublequote ? NULL : format_chars; + return format_chars + nchars - 1; + } + if (format_chars[0] == '\'') + { + baltoks.singlequote = baltoks.singlequote ? NULL : format_chars; + return format_chars + nchars - 1; + } + } + + if (fmtchrpos == 0) + { + if (nchars == 1 + && format_chars[0] == '(') + ; /* Text beginning in an open parenthesis. */ + else if (nchars == 3 + && !strncmp (format_chars, "...", 3) + && format_chars[3]) + ; /* Text beginning in an ellipsis. */ + else + { + format_warning_substr (format_string_loc, format_string_cst, + fmtchrpos, fmtchrpos + nchars, opt, + (nchars > 1 + ? G_("spurious leading punctuation " + "characters %<%.*s%> in format") + : G_("spurious leading punctuation " + "character %<%.*s%> in format")), + nchars, format_chars); + return format_chars + nchars - 1; + } + } + else if (!format_chars[nchars]) + { + if (nchars == 1 + && (format_chars[nchars - 1] == ':' + || format_chars[nchars - 1] == ')')) + ; /* Text ending in a colon or a closing parenthesis. */ + else if (nchars == 1 + && ((ISUPPER (*orig_format_chars) + && format_chars[nchars - 1] == '.') + || strspn (format_chars + nchars - 1, "?])") == 1)) + ; /* Capitalized sentence terminated by a single period, + or text ending in a question mark, closing bracket, + or parenthesis. */ + else if (nchars == 2 + && format_chars - orig_format_chars > 0 + && (TOUPPER (format_chars[-1]) == 'C' + || TOUPPER (format_chars[-1]) == 'G')) + ; /* Trailing reference to C++ or G++. */ + else if (nchars == 2 + && format_chars[0] == '?' + && format_chars[1] == ')') + ; /* A question mark after a closing parenthetical note. */ + else if (nchars == 2 + && format_chars[0] == ')' + && (format_chars[1] == '?' + || format_chars[1] == ';' + || format_chars[1] == ':' + || (ISUPPER (*orig_format_chars) + && format_chars[1] == '.'))) + ; /* Closing parethetical note followed by a question mark, + semicolon, or colon at the end of the string, or by + a period at the end of a capitalized sentence. */ + else if (nchars == 3 + && format_chars - orig_format_chars > 0 + && !strncmp (format_chars, "...", 3)) + ; /* Text ending in the ellipsis. */ + else + format_warning_substr (format_string_loc, format_string_cst, + fmtchrpos, fmtchrpos + nchars, opt, + (nchars > 1 + ? G_("spurious trailing punctuation " + "characters %<%.*s%> in format") + : G_("spurious trailing punctuation " + "character %<%.*s%> in format")), + nchars, format_chars); + + return format_chars + nchars - 1; + } + else if (nchars == 2 + && format_chars - orig_format_chars > 0 + && (!strncasecmp (format_chars - 1, "c++", 3) + || !strncasecmp (format_chars - 1, "g++", 3))) + ; /* Reference to C++. */ + else if (nchars == 2 + && format_chars[0] == ')' + && (format_chars[1] == ':' + || format_chars[1] == ';' + || format_chars[1] == ',') + && format_chars[2] == ' ') + ; /* Closing parethetical note followed by a colon, semicolon + or a comma followed by a space in the middle of the string. */ + else if (nchars > 1) + format_warning_substr (format_string_loc, format_string_cst, + fmtchrpos, fmtchrpos + nchars, opt, + "unquoted sequence of %i consecutive " + "punctuation characters %q.*s in format", + nchars, nchars, format_chars); + return format_chars + nchars - 1; + } + + nchars = 0; + + /* Finally, diagnose any unquoted non-graph, non-punctuation characters + other than the terminating NUL. */ + while (format_chars[nchars] + && '%' != format_chars[nchars] + && !ISPUNCT (format_chars[nchars]) + && !ISGRAPH (format_chars[nchars])) + ++nchars; + + if (nchars > 1) + { + format_warning_substr (format_string_loc, format_string_cst, + fmtchrpos, fmtchrpos + nchars, opt, + "unquoted non-graph characters in format"); + return format_chars + nchars - 1; + } + if (nchars) + { + format_warning_substr (format_string_loc, format_string_cst, + fmtchrpos, fmtchrpos + nchars, opt, + "unquoted non-graph character %qc in format", + *format_chars); + return format_chars + nchars - 1; + } + + return format_chars; +} + +static void +maybe_diag_unbalanced_tokens (location_t format_string_loc, + const char *orig_format_chars, + tree format_string_cst, + baltoks_t &baltoks) +{ + const char *unbalanced = NULL; + + if (baltoks.brackets.length ()) + unbalanced = baltoks.brackets.pop (); + else if (baltoks.curly.length ()) + unbalanced = baltoks.curly.pop (); + else if (baltoks.parens.length ()) + unbalanced = baltoks.parens.pop (); + else if (baltoks.pointy.length ()) + unbalanced = baltoks.pointy.pop (); + + if (unbalanced) + format_warning_at_char (format_string_loc, format_string_cst, + unbalanced - orig_format_chars + 1, + OPT_Wformat_diag, + "unbalanced punctuation character %<%c%> in format", + *unbalanced); + + if (baltoks.quotdirs.length ()) + format_warning_at_char (format_string_loc, format_string_cst, + baltoks.quotdirs.pop () - orig_format_chars, + OPT_Wformat_, + "unterminated quoting directive"); + + const char *quote + = baltoks.singlequote ? baltoks.singlequote : baltoks.doublequote; + + if (quote) + format_warning_at_char (format_string_loc, format_string_cst, + quote - orig_format_chars + 1, + OPT_Wformat_diag, + "unterminated quote character %<%c%> in format", + *quote); +} + /* Do the main part of checking a call to a format function. FORMAT_CHARS is the NUL-terminated format string (which at this point may contain internal NUL characters); FORMAT_LENGTH is its length (excluding the @@ -2816,8 +3733,10 @@ check_format_info_main (format_check_results *res, and it didn't use $; 1 if $ formats are in use. */ int has_operand_number = -1; - /* Vector of pointers to opening quoting directives (like GCC "%<"). */ - auto_vec quotdirs; + /* Vectors of pointers to opening quoting directives (like GCC "%<"), + opening braces, brackets, and parentheses. Used to detect unbalanced + tokens. */ + baltoks_t baltoks; /* Pointers to the most recent color directives (like GCC's "%r or %R"). A starting color directive much be terminated before the end of @@ -2828,10 +3747,26 @@ check_format_info_main (format_check_results *res, init_dollar_format_checking (info->first_arg_num, first_fillin_param); + /* In GCC diagnostic functions check plain directives (substrings within + the format string that don't start with %) for quoting and punctuations + problems. */ + bool ck_plain = (!info->is_raw + && (info->format_type == gcc_diag_format_type + || info->format_type == gcc_tdiag_format_type + || info->format_type == gcc_cdiag_format_type + || info->format_type == gcc_cxxdiag_format_type)); + while (*format_chars != 0) { - if (*format_chars++ != '%') + if (ck_plain) + format_chars = check_plain (format_string_loc, + format_string_cst, + orig_format_chars, format_chars, + baltoks); + + if (*format_chars == 0 || *format_chars++ != '%') continue; + if (*format_chars == 0) { format_warning_at_char (format_string_loc, format_string_cst, @@ -2846,6 +3781,8 @@ check_format_info_main (format_check_results *res, continue; } + /* ARGUMENT_PARSER ctor takes FORMAT_CHARS by reference and calls + to ARG_PARSER members may modify the variable. */ flag_chars_t flag_chars; argument_parser arg_parser (info, format_chars, format_string_cst, orig_format_chars, format_string_loc, @@ -2908,7 +3845,7 @@ check_format_info_main (format_check_results *res, flag_chars.validate (fki, fci, flag_specs, format_chars, format_string_cst, format_string_loc, orig_format_chars, format_char, - quotdirs.length () > 0); + baltoks.quotdirs.length () > 0); const int alloc_flag = flag_chars.get_alloc_flag (fki); const bool suppressed = flag_chars.assignment_suppression_p (fki); @@ -2920,17 +3857,17 @@ check_format_info_main (format_check_results *res, if (quot_begin_p && !quot_end_p) { - if (quotdirs.length ()) + if (baltoks.quotdirs.length ()) format_warning_at_char (format_string_loc, format_string_cst, format_chars - orig_format_chars, OPT_Wformat_, "nested quoting directive"); - quotdirs.safe_push (format_chars); + baltoks.quotdirs.safe_push (format_chars); } else if (!quot_begin_p && quot_end_p) { - if (quotdirs.length ()) - quotdirs.pop (); + if (baltoks.quotdirs.length ()) + baltoks.quotdirs.pop (); else format_warning_at_char (format_string_loc, format_string_cst, format_chars - orig_format_chars, @@ -2962,7 +3899,7 @@ check_format_info_main (format_check_results *res, /* Diagnose directives that shouldn't appear in a quoted sequence. (They are denoted by a double quote in FLAGS2.) */ - if (quotdirs.length ()) + if (baltoks.quotdirs.length ()) { if (strchr (fci->flags2, '"')) format_warning_at_char (format_string_loc, format_string_cst, @@ -3018,10 +3955,9 @@ check_format_info_main (format_check_results *res, if (has_operand_number > 0) finish_dollar_format_checking (res, fki->flags & (int) FMT_FLAG_DOLLAR_GAP_POINTER_OK); - if (quotdirs.length ()) - format_warning_at_char (format_string_loc, format_string_cst, - quotdirs.pop () - orig_format_chars, - OPT_Wformat_, "unterminated quoting directive"); + maybe_diag_unbalanced_tokens (format_string_loc, orig_format_chars, + format_string_cst, baltoks); + if (color_begin && !color_end) format_warning_at_char (format_string_loc, format_string_cst, color_begin - orig_format_chars, @@ -4199,7 +5135,7 @@ handle_format_attribute (tree *node, tree atname, tree args, if (arg_num != info.first_arg_num) { if (!(flags & (int) ATTR_FLAG_BUILT_IN)) - error ("args to be formatted is not %<...%>"); + error ("argument to be formatted is not %<...%>"); *no_add_attrs = true; return NULL_TREE; } diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt index 916cc67b453..046d489f7eb 100644 --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt @@ -562,6 +562,10 @@ Wformat-contains-nul C ObjC C++ ObjC++ Var(warn_format_contains_nul) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 1, 0) Warn about format strings that contain NUL bytes. +Wformat-diag +C ObjC C++ ObjC++ Var(warn_format_diag) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 1, 0) +Warn about GCC format strings with strings unsuitable for diagnostics.. + Wformat-extra-args C ObjC C++ ObjC++ Var(warn_format_extra_args) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 1, 0) Warn if passing too many arguments to a function for its format string. diff --git a/gcc/testsuite/gcc.dg/format/gcc_diag-11.c b/gcc/testsuite/gcc.dg/format/gcc_diag-11.c new file mode 100644 index 00000000000..a716c8de7ef --- /dev/null +++ b/gcc/testsuite/gcc.dg/format/gcc_diag-11.c @@ -0,0 +1,382 @@ +/* Test warnings for for GCC diagnostics. + { dg-do compile } + { dg-options "-Wformat -Wformat-diag" } */ + +/* Magic identifiers must be set before the attribute is used. */ + +typedef long long __gcc_host_wide_int__; + +typedef struct location_s +{ + const char *file; + int line; +} location_t; + +union tree_node; +typedef union tree_node *tree; + +/* Define gimple as a dummy type. The typedef must be provided for + the C test to find the symbol. */ +typedef struct gimple gimple; + +/* Likewise for gimple. */ +typedef struct cgraph_node cgraph_node; + +#define FORMAT(kind) __attribute__ ((format (__gcc_## kind ##__, 1, 2))) + +/* Basic formatting function like pp_format. */ +void diag (const char*, ...) FORMAT (diag); + +/* Diagnostic formatting function like error or warning declared + by the C front end. */ +void cdiag (const char*, ...) FORMAT (cdiag); + +/* Diagnostic formatting function like error or warning declared + by the middle-end or back-end. */ +void tdiag (const char*, ...) FORMAT (tdiag); + +/* Diagnostic formatting function like error or warning declared + by the C++ front-end. */ +void cxxdiag (const char*, ...) FORMAT (cxxdiag); + +void dump (const char*, ...) FORMAT (dump_printf); + +/* Verify that functions declared with the C/C++ front-end __gcc_cdiag__ + attribute detect invalid whitespace in format strings. */ + +void test_cdiag_whitespace (tree t, gimple *gc) +{ + (void)&t; (void)&gc; + + /* Verify that strings of leading spaces don't trigger a warning. */ + cdiag (" a"); + cdiag (" b"); + cdiag (" c"); + cdiag ("%< %>a"); + cdiag ("%< %>a"); + cdiag ("a b"); + cdiag ("a b"); /* { dg-warning "unquoted sequence of 2 consecutive space characters" } */ + cdiag ("a "); /* { dg-warning "spurious trailing space character" } */ + cdiag ("a "); /* { dg-warning "spurious trailing space characters" } */ + cdiag ("a%< %>"); + cdiag ("a%< %>%< %>"); + cdiag ("a%< %> "); /* { dg-warning "spurious trailing space character" } */ + cdiag ("a%< %> %< %>"); /* { dg-warning "unquoted sequence of 2 consecutive space characters" } */ + + /* It's debatable whether the following two formst strings should + be cdiagnosed. They aren't only because it's simpler that way. */ + cdiag ("a %< %>"); + cdiag ("a%< %> %< %>"); + + /* Exercise other whitespace characters. */ + cdiag ("a\fb"); /* { dg-warning "unquoted whitespace character '\\\\x0c'" } */ + cdiag ("a\nb"); /* { dg-warning "unquoted whitespace character '\\\\x0a'" } */ + cdiag ("a\rb"); /* { dg-warning "unquoted whitespace character '\\\\x0d'" } */ + cdiag ("a\vb"); /* { dg-warning "unquoted whitespace character '\\\\x0b'" } */ + + cdiag ("First sentence. And a next."); + cdiag ("First sentence. not capitalized sentence"); /* { dg-warning "inconsistent capitalization" } */ + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-diag" + + /* Verify that the warning can be suppressed. */ + cdiag ("\ta\b c\vb\n"); + +#pragma GCC diagnostic pop +} + + +void test_cdiag_control (tree t, gimple *gc) +{ + (void)&t; (void)&gc; + + cdiag ("\1"); /* { dg-warning "unquoted control character '\\\\x01'" } */ + cdiag ("a\ab"); /* { dg-warning "unquoted control character '\\\\x07'" } */ + cdiag ("a\bb"); /* { dg-warning "unquoted control character '\\\\x08'" } */ +} + + +void test_cdiag_punct (tree t, gimple *gc, int i) +{ + (void)&t; (void)&gc; + + /* Exercise the period. */ + cdiag (".abc"); /* { dg-warning "spurious leading punctuation character" } */ + cdiag ("abc;"); /* { dg-warning "spurious trailing punctuation character" } */ + /* Verify that sentences that start with an uppercase letter and end + in a period are not diagnosed. */ + cdiag ("This is a full sentence."); + cdiag ("Capitalized sentence (with a parethetical note)."); + cdiag ("Not a full sentence;"); /* { dg-warning "spurious trailing punctuation character" } */ + cdiag ("Neither is this one,"); /* { dg-warning "spurious trailing punctuation character" } */ + + /* Exercise the ellipsis. */ + cdiag ("this message..."); + cdiag ("...continues here"); + cdiag ("but...not here"); /* { dg-warning "unquoted sequence of 3 consecutive punctuation characters" } */ + + /* Verify that parenthesized sentences are accepted, even the whole + meesage (done in the C++ front end). */ + cdiag ("null argument where non-null required (argument %i)", i); + cdiag ("null (argument %i) where non-null required", i); + cdiag ("(see what comes next)"); + + /* Verify that only a single trailing colon is accepted. */ + cdiag ("candidates are:"); + cdiag ("candidates are::"); /* { dg-warning "spurious trailing punctuation characters" } */ + + /* Exercise C++. */ + cdiag ("C++ is cool"); + cdiag ("this is c++"); + cdiag ("you can do this in C++ but not in C"); + + /* Also verify that G++ is accepted. */ + cdiag ("G++ rocks"); + cdiag ("this is accepted by g++"); + cdiag ("valid in G++ (or g++) but not in gcc"); + + /* Exercise parenthetical note followed by a colon, semicolon, + or a comma. */ + cdiag ("found a bug (here):"); + cdiag ("because of another bug (over there); fix it"); + + cdiag ("found foo (123): go look at it"); + cdiag ("missed bar (abc); will try harder next time"); + + cdiag ("expected this (or that), got something else (or who knows what)"); + + /* Exercise parenthetical note with a question mark. */ + cdiag ("hmmm (did you really mean that?)"); + cdiag ("error (did you mean %?)"); + /* And a question mark after a parenthetical note. */ + cdiag ("did you mean this (or that)?"); + + /* But make sure unbalanced parenthese are diagnosed. */ + cdiag ("or this or the other)?"); /* { dg-warning "unbalanced punctuation character '\\\)'" } */ + + cdiag ("## Heading"); /* { dg-warning "spurious leading punctuation characters '##'" } */ + cdiag ("## %s ##", "1"); /* { dg-warning "spurious (leading|trailing) punctuation characters '##'" } */ + + cdiag ("#1 priority"); /* { dg-warning "spurious leading punctuation character '#'" } */ + cdiag ("priority #2"); + + /* Quoting. */ + cdiag ("\"quoted\""); + cdiag ("\"quoted\" string"); + cdiag ("this is a \"string in quotes\""); + cdiag ("\"missing closing quote"); /* { dg-warning "unterminated quote character '\"'" } */ + + /* PR translation/90121 - punctuation character after a space. */ + cdiag ("bad version : 1"); /* { dg-warning "space followed by punctuation character ':'" } */ + cdiag ("problem ; fix it"); /* { dg-warning "space followed by punctuation character ';'" } */ + cdiag ("End . not."); /* { dg-warning "space followed by punctuation character '.'" } */ + cdiag ("it is bad , very bad"); /* { dg-warning "space followed by punctuation character ','" } */ + cdiag ("say what ?"); /* { dg-warning "space followed by punctuation character '?'" } */ + /* But these are okay after a space. */ + cdiag ("1 / 2"); + cdiag ("2 + 3"); + cdiag ("2 + 3"); +} + +void test_cdiag_punct_balance (tree t, gimple *gc) +{ + (void)&t; (void)&gc; + + cdiag ("f()"); /* { dg-warning "spurious trailing punctuation characters" } */ + cdiag ("g(1)"); + cdiag ("("); /* { dg-warning "spurious leading punctuation character|unbalanced" } */ + cdiag ("()"); /* { dg-warning "spurious leading punctuation characters" } */ + cdiag (")"); /* { dg-warning "unbalanced punctuation character '\\\)'" } */ + cdiag ("f()g"); /* { dg-warning "unquoted sequence of 2 consecutive punctuation characters" } */ + cdiag ("illegal operand (1)"); +} + + +void test_cdiag_nongraph (tree t, gimple *gc) +{ + (void)&t; (void)&gc; + + cdiag ("a\376b"); /* { dg-warning "unquoted non-graph character '\\\\xfe'" } */ + cdiag ("a\377b"); /* { dg-warning "unquoted non-graph character '\\\\xff'" } */ +} + + +void test_cdiag_attribute (tree t, gimple *gc) +{ + (void)&t; (void)&gc; + + cdiag ("attribute foo"); + cdiag ("this is attribute bar"); + cdiag ("bad __attribute bar"); /* { dg-warning "unquoted attribute" } */ + cdiag ("__attribute__ (foobar) bad"); /* { dg-warning "unquoted attribute" } */ + cdiag ("__attribute__ ((foobar))"); /* { dg-warning "unquoted attribute" } */ + cdiag ("__attribute__ (xxx))"); /* { dg-warning "unquoted attribute" } */ + /* { dg-warning "unbalanced punctuation character '\\\)'" "xxx" { target *-*-* } .-1 } */ + cdiag ("__attribute__ ((yyy)))"); /* { dg-warning "unquoted attribute" } */ + /* { dg-warning "unbalanced punctuation character '\\\)'" "yyy" { target *-*-* } .-1 } */ + cdiag ("__attribute__ ((zzz)"); /* { dg-warning "unquoted attribute" } */ + /* { dg-warning "unbalanced punctuation character '\\\('" "zzz" { target *-*-* } .-1 } */ + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-diag" + + /* Verify that the warning can be suppressed. */ + cdiag ("__attribute__ ((("); + +#pragma GCC diagnostic pop +} + +void test_cdiag_builtin (tree t, gimple *gc) +{ + (void)&t; (void)&gc; + + cdiag ("__builtin_abort"); /* { dg-warning "unquoted name of built-in function '__builtin_abort'" } */ + cdiag ("in __builtin_trap"); /* { dg-warning "unquoted name of built-in function '__builtin_trap'" } */ + cdiag ("__builtin_xyz bites");/* { dg-warning "unquoted name of built-in function '__builtin_xyz'" } */ + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-diag" + + /* Verify that the warning can be suppressed. */ + cdiag ("__builtin____with____lots__of__underscores"); + +#pragma GCC diagnostic pop +} + + +void test_cdiag_option (tree t, gimple *gc) +{ + (void)&t; (void)&gc; + + cdiag ("%<-Wall%>"); + cdiag ("use option %<-Wextra%> to enable additinal warnings"); + + cdiag ("-O2 is fast"); /* { dg-warning "unquoted option name '-O2'" } */ + cdiag ("but -O3 is faster"); /* { dg-warning "unquoted option name '-O3'" } */ + + cdiag ("get --help"); /* { dg-warning "unquoted option name '--help'" } */ + cdiag ("enable -m32"); /* { dg-warning "unquoted option name '-m32'" } */ + cdiag ("value is -12"); + cdiag ("foo-O2"); + cdiag ("a-W"); +} + + +void test_cdiag_keyword (tree t, gimple *gc) +{ + cdiag ("malignofer or alignofus"); + cdiag ("use alignof"); /* { dg-warning "unquoted keyword 'alignof'" } */ + cdiag ("or _Alignof"); /* { dg-warning " keyword '_Alignof'" } */ + cdiag ("_Pragma too"); /* { dg-warning " keyword '_Pragma'" } */ + + cdiag ("a #error directive"); /* { dg-warning "unquoted preprocessing directive '#error'" } */ + cdiag ("#include file"); /* { dg-warning "unquoted preprocessing directive '#include'" } */ + cdiag ("but #pragma foobar"); /* { dg-warning "unquoted preprocessing directive '#pragma'" } */ + cdiag ("pragma foobar is okay"); + cdiag ("or even # pragma is fine"); + + cdiag ("an offsetof here"); /* { dg-warning "unquoted keyword 'offsetof" } */ + cdiag ("sizeof x"); /* { dg-warning "unquoted keyword 'sizeof" } */ + cdiag ("have typeof"); /* { dg-warning "unquoted keyword 'typeof" } */ +} + + +void test_cdiag_operator (tree t, gimple *gc) +{ + cdiag ("a == b"); /* { dg-warning "unquoted operator '=='" } */ + cdiag ("++a"); /* { dg-warning "unquoted operator '\\\+\\\+'" } */ + cdiag ("b--"); /* { dg-warning "unquoted operator '--'" } */ +} + + +void test_cdiag_type_name (tree t, gimple *gc) +{ + cdiag ("the word character should not be quoted"); + cdiag ("but char should be"); /* { dg-warning "unquoted keyword 'char'" } */ + + cdiag ("unsigned char should be quoted"); /* { dg-warning "unquoted type name 'unsigned char'" } */ + cdiag ("but unsigned character is fine"); + + cdiag ("as should int"); /* { dg-warning "unquoted keyword 'int'" } */ + cdiag ("and signed int"); /* { dg-warning "unquoted type name 'signed int'" } */ + cdiag ("and also unsigned int"); /* { dg-warning "unquoted type name 'unsigned int'" } */ + cdiag ("very long thing"); + cdiag ("use long long here"); /* { dg-warning "unquoted type name 'long long'" } */ + + cdiag ("have a floating type"); + cdiag ("found float type"); /* { dg-warning "unquoted keyword 'float'" } */ + + cdiag ("break rules"); + cdiag ("if we continue by default for a short while else do nothing"); + cdiag ("register a function for unsigned extern to void const reads"); + cdiag ("or volatile access"); +} + + +void test_cdiag_identifier (tree t, gimple *gc) +{ + (void)&t; (void)&gc; + + cdiag ("private _x ident"); /* { dg-warning "unquoted identifier or keyword '_x'" } */ + cdiag ("and another __y"); /* { dg-warning "unquoted identifier or keyword '__y'" } */ + cdiag ("ident z_ with trailing underscore"); /* { dg-warning "unquoted identifier or keyword 'z_'" } */ + cdiag ("v_ variable"); /* { dg-warning "unquoted identifier or keyword 'v_'" } */ + cdiag ("call foo_bar"); /* { dg-warning "unquoted identifier or keyword 'foo_bar'" } */ + cdiag ("unqoted x_y ident"); /* { dg-warning "unquoted identifier or keyword 'x_y'" } */ + + cdiag ("size_t type"); /* { dg-warning "unquoted identifier or keyword 'size_t'" } */ + cdiag ("bigger than INT_MAX");/* { dg-warning "unquoted identifier or keyword 'INT_MAX'" } */ + + cdiag ("quoted ident %"); + cdiag ("another quoted identifier % here"); +} + + +void test_cdiag_bad_words (tree t, gimple *gc) +{ + (void)&t; (void)&gc; + + cdiag ("arn't you dumb?"); /* { dg-warning "bare apostrophe ''' in format" } */ + cdiag ("you can't do that"); /* { dg-warning "contraction 'can't' in format" } */ + cdiag ("you can%'t do that");/* { dg-warning "contraction 'can%'t' in format" "FIXME" { xfail *-*-* } } */ + cdiag ("it mustn't be"); /* { dg-warning "contraction 'mustn't' in format" } */ + cdiag ("isn't that silly?"); /* { dg-warning "bare apostrophe ''' in format" } */ + + cdiag ("can not do this"); /* { dg-warning "'can not' is not a word; use 'cannot' instead" } */ + cdiag ("you can not"); /* { dg-warning "'can not' is not a word; use 'cannot' instead" } */ + + /* See PR target/90157 - aarch64: unnecessary abbreviation in diagnostic */ + cdiag ("arg 1"); /* { dg-warning "'arg' is not a word; use 'argument' instead" } */ + cdiag ("bad arg"); /* { dg-warning "'arg' is not a word; use 'argument' instead" } */ + cdiag ("two args"); /* { dg-warning "'args' is not a word; use 'arguments' instead" } */ + cdiag ("args 1 and 2"); /* { dg-warning "'args' is not a word; use 'arguments' instead" } */ + + cdiag ("reg A"); /* { dg-warning "'reg' is not a word; use 'register' instead" } */ + cdiag ("regs A and B"); /* { dg-warning "'regs' is not a word; use 'registers' instead" } */ + cdiag ("no regs"); /* { dg-warning "'regs' is not a word; use 'registers' instead" } */ +} + + +void test_cdiag_directive (tree t, gimple *gc) +{ + (void)&t; (void)&gc; + + cxxdiag ("%<%s%>", ""); /* { dg-warning "quoted '%s' directive in format" } */ + /* This was asked to be diagnosed in PR #90158 but there, the \"%s\" + is in parenheses which ends up getting diagnosed because of + the two consecutive punctuation characters, ( and ". */ + cdiag ("\"%s\"", ""); /* { dg-warning "quoted '%s' directive in format" } */ + + /* Make sure quoted paired tokens are not diagnosed. */ + cdiag ("%<'%>"); + cdiag ("%<\"%>"); + cdiag ("%<<%>"); + cdiag ("%<>%>"); + cdiag ("%<(%>"); + cdiag ("%<)%>"); + cdiag ("%<[%>"); + cdiag ("%<]%>"); + + cdiag ("%<'%> %<\"%> %<>%> %<<%> %<)%> %<(%> %<]%> %<[%>"); +} From patchwork Tue May 14 21:31:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Sebor X-Patchwork-Id: 1099735 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-500687-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="inhE3W6z"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="NPPNeok3"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 453W9R054Kz9sNm for ; Wed, 15 May 2019 07:32:10 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=qLfX31qPJ5Zb4zZkLLpJXQke452Bp7cazQTDatkZgN95ZuqZOR 1lM+dkDGN5BH+AxQH/U6bEPAVNnTXKLD4v0F7O7F55Ur+GDVl9T4oP58qX4Aqfj9 XGy/PnJCu8syWfHB15Kloy30CD9tYndKnpI83fbrD4vS4tBZBFC99X/R0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=VBuc+w783dvJwyvA/knUWpRik3Y=; b=inhE3W6zn+RAqMwqvh+3 ZUa8wmpY4YqfVYen/TPpedmMOYeg95GXtp9DCenLk/39EVd/IBWMB6CIb3Os5xYU VmM0cZomv5AVBzw9ZyhCsA/kRQiGC82GNlkfy7DcF4V3oBkwlONcZKDTluDwBJQB 8tQmuVGZdgyAr/2cQKU0qp4= Received: (qmail 36296 invoked by alias); 14 May 2019 21:32:02 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 36245 invoked by uid 89); 14 May 2019 21:32:02 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-15.5 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=Quote, trans.c, transc, UD:trans.c X-HELO: mail-qt1-f176.google.com Received: from mail-qt1-f176.google.com (HELO mail-qt1-f176.google.com) (209.85.160.176) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 14 May 2019 21:32:00 +0000 Received: by mail-qt1-f176.google.com with SMTP id a17so893468qth.3 for ; Tue, 14 May 2019 14:32:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:date:user-agent:mime-version :content-language; bh=wnuxMSeVJYtbdr4IR8bTglQ2NLQIrm1/Mi1XJivfEyQ=; b=NPPNeok38BDhwqNDPU84NIPdRCVCeuuG49h3Q2mVpd/9Wd2inUf5yAiI26OJXdoq5H 0mf2AqazmPGq6o2uMDc+tAhZ+7A0ynzx6sNvW6kbGY5JQDiSaUfrUuJgvxqiqRq7SqjC wVe21w/KfpiUNAgaeQ9PuCOi/Ia+gnjkCo+K4qeDkJR6xUs2PyUruKyjwYT/zItQtYqm 0AZPD0eGhU+kVGGXKsPVtQmwAQvL5wZ5+Ue1Fyuh1cc2RoyifkWnudwfZqxk3AGvutvr BfVILb23NQrjmLdRCLG/bruGhTTu0jg38k16mAseeJeGTSe9S6UcwQzHXKurpLwJgl5B gOBA== Received: from [192.168.0.41] (97-118-125-210.hlrn.qwest.net. [97.118.125.210]) by smtp.gmail.com with ESMTPSA id s3sm120292qtb.12.2019.05.14.14.31.57 for (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Tue, 14 May 2019 14:31:57 -0700 (PDT) To: gcc-patches From: Martin Sebor Subject: [PATCH 2/12] fix diagnostic quoting/spelling in ada Message-ID: <3c27e58d-7803-ce5e-8e10-4dc4b2afc2e8@gmail.com> Date: Tue, 14 May 2019 15:31:56 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 MIME-Version: 1.0 X-IsSubscribed: yes The attached patch fixes quoting, spelling, and other formatting issues in diagnostics issued by the Ada front and pointed out by the -Wformat-diag warning. Martin gcc/ada/ChangeLog: * gcc-interface/trans.c (check_inlining_for_nested_subprog): Quote reserved names. diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index 155cb4b27ab..932a54ca111 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -2024,12 +2024,13 @@ check_inlining_for_nested_subprog (tree fndecl) if (lookup_attribute ("always_inline", DECL_ATTRIBUTES (parent_decl))) { - error_at (loc1, "subprogram %q+F not marked Inline_Always", fndecl); + error_at (loc1, "subprogram %q+F not marked %", + fndecl); error_at (loc2, "parent subprogram cannot be inlined"); } else { - warning_at (loc1, OPT_Winline, "subprogram %q+F not marked Inline", + warning_at (loc1, OPT_Winline, "subprogram %q+F not marked %", fndecl); warning_at (loc2, OPT_Winline, "parent subprogram cannot be inlined"); } From patchwork Tue May 14 21:32:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Sebor X-Patchwork-Id: 1099737 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-500689-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="j3jid4a6"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Ep25AUVg"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 453WB840tkz9sNd for ; Wed, 15 May 2019 07:32:48 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=Lrz04mkpqD0Rjy/Q5swldJt2aP9KN+38lX1AXGzopbj7xx7A0t 84gfu03Gp+ZLvmS8DMUCLOf6oPRqxMVj8ts8Tl2IrwYmmwJohvy8osBCom848pDH ZyfPVabGK2XpTzZDKig/zxaU4lnO+J18HWhn9SpzFWTk3pKPrYIIgGmqg= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=gZyT/o/mebhcsyc8cPZ/axdtOms=; b=j3jid4a6KouTvcKJqQ+n DCxqZhfpNzP+9EXy3zzUwd7YuRBuHtMA1TyiVfhpXlfeEHjtwq49pxbkekdbIkqG Netm+0WJo1p6qYrQ/gIYMxzTbi4ODG58y8J59QvPK9oHKO6umXwDilmarKcgh2fr kpYLvYKp9XP827fd7buzWmo= Received: (qmail 37253 invoked by alias); 14 May 2019 21:32:10 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 37207 invoked by uid 89); 14 May 2019 21:32:09 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.0 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=2810 X-HELO: mail-qk1-f182.google.com Received: from mail-qk1-f182.google.com (HELO mail-qk1-f182.google.com) (209.85.222.182) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 14 May 2019 21:32:08 +0000 Received: by mail-qk1-f182.google.com with SMTP id j1so189050qkk.12 for ; Tue, 14 May 2019 14:32:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:date:user-agent:mime-version :content-language; bh=CEykfkAVpLJ6Jr/ShZ5Zx8l2GDB4d/vmryLSr0OVLlw=; b=Ep25AUVgTP7KzZgGfYT7GMbbGJriwrQ9Kbyd/doU7nyfd4BIFPAF8dJsS9EiMyF/QB UxtIgJYmfIumN34KUAFnN0ptn5omJFT8jEqrqXiTVl2Kz27jBE1Uu3tywziuzLiSJMJZ 3sc95oHTk2/wuyBAlacE2QM4AkQ4BScIw+UTVZaUk/ryTDgdMnZNNB0xqjNIYCcOVdxU BsG74g2DQKDG+Ob4FB9P8ZQS1u+DHTV5dxUdfpT4yCIa26yCxyVUvyuiYcbpkgmdIvhz BXAVrK5XelfQO6PNP1uVs8cWrLqWKLjMvAgPftnaxZrogNoUM6TlUfWRgpT0+eyMjhy7 3eWw== Received: from [192.168.0.41] (97-118-125-210.hlrn.qwest.net. [97.118.125.210]) by smtp.gmail.com with ESMTPSA id n62sm9136843qkd.76.2019.05.14.14.32.04 for (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Tue, 14 May 2019 14:32:05 -0700 (PDT) To: gcc-patches From: Martin Sebor Subject: [PATCH 3/12] fix diagnostic quoting/spelling in Brig Message-ID: Date: Tue, 14 May 2019 15:32:04 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 MIME-Version: 1.0 X-IsSubscribed: yes The attached patch fixes quoting, spelling, and other formatting issues in diagnostics issued by the Brig front end and pointed out by the -Wformat-diag warning. Martin gcc/brig/ChangeLog: * brigfrontend/brig-control-handler.cc (brig_directive_control_handler::operator): Remove trailing newline from a diagnostic. * brigfrontend/brig-module-handler.cc (brig_directive_module_handler::operator): Remove a duplicated space from a diagnostic. diff --git a/gcc/brig/brigfrontend/brig-control-handler.cc b/gcc/brig/brigfrontend/brig-control-handler.cc index 38039315c7c..4374c469a39 100644 --- a/gcc/brig/brigfrontend/brig-control-handler.cc +++ b/gcc/brig/brigfrontend/brig-control-handler.cc @@ -102,7 +102,7 @@ brig_directive_control_handler::operator () (const BrigBase *base) /* Unimplemented. */ break; default: - sorry ("Unsupported control directive %x.\n", inst->control); + sorry ("Unsupported control directive %x.", inst->control); } return base->byteCount; } diff --git a/gcc/brig/brigfrontend/brig-module-handler.cc b/gcc/brig/brigfrontend/brig-module-handler.cc index 58a65d65574..e1551b93812 100644 --- a/gcc/brig/brigfrontend/brig-module-handler.cc +++ b/gcc/brig/brigfrontend/brig-module-handler.cc @@ -28,10 +28,10 @@ brig_directive_module_handler::operator () (const BrigBase *base) const BrigDirectiveModule* mod = (const BrigDirectiveModule*)base; m_parent.m_module_name = m_parent.get_string (mod->name).substr (1); if (mod->hsailMajor != 1 || mod->hsailMinor != 0) - fatal_error (UNKNOWN_LOCATION, PHSA_ERROR_PREFIX_INCOMPATIBLE_MODULE " " + fatal_error (UNKNOWN_LOCATION, PHSA_ERROR_PREFIX_INCOMPATIBLE_MODULE "HSAIL version not supported. HSAIL 1.0 required."); if (mod->machineModel != BRIG_MACHINE_LARGE) - fatal_error (UNKNOWN_LOCATION, PHSA_ERROR_PREFIX_INCOMPATIBLE_MODULE " " + fatal_error (UNKNOWN_LOCATION, PHSA_ERROR_PREFIX_INCOMPATIBLE_MODULE "Only HSA 'large' machine model supported."); /* Do not check for the profile as the runtime conformance suite tests with 'full' profile BRIGs even though they don't use any full profile From patchwork Tue May 14 21:32:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Sebor X-Patchwork-Id: 1099738 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-500690-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="hvhhgxJb"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="UAJkw8HZ"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 453WBT3DQMz9sNd for ; Wed, 15 May 2019 07:33:03 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=cuWcLr8JKxgYOSScAon56wwQfh910wTMW+vTRfPwE6jMMn5QbL CkC6AYSrHDW3jlwVsQKjAXuJrAQzMZxXep9JxCMqybUNiq8DAbkoYqJryTAUQQ3m yOrAuhoWNAyo58zErsMNSAfL/NgIUXy1JD6KG2/jzajML4g2Lok53SYqI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=PBMZzIe0gAvmBQx1FdR6zWgMvDA=; b=hvhhgxJbj0Wpk5aYaEQK 7CI5snmG4hmZMABZ445ANIOuwAQKvQBRjhgsGnwAUqeipo18CloL5WBV0DbGGvl+ GhSze6KpHCaD7RvRof4P15UTxOJiArpl8fzzDBG1g/QBsCodRZxcx4E+nCQs5ggI LQ5DigIKcuXIyl1uRDh5sj8= Received: (qmail 38421 invoked by alias); 14 May 2019 21:32:20 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 38223 invoked by uid 89); 14 May 2019 21:32:18 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.9 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=sk:constru, code1 X-HELO: mail-qt1-f171.google.com Received: from mail-qt1-f171.google.com (HELO mail-qt1-f171.google.com) (209.85.160.171) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 14 May 2019 21:32:16 +0000 Received: by mail-qt1-f171.google.com with SMTP id y42so866546qtk.6 for ; Tue, 14 May 2019 14:32:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:date:user-agent:mime-version :content-language; bh=4GqA99CB3gej1f8c4QmnPhNAwDYQWQDxVbVHlV1kFJY=; b=UAJkw8HZ/5MZlAmE3R9NGXNcCFF2VKPBd3J1XNOu5jfeVEuAc0K5SkquzdL8xo7gVj s91eA2HpjKEgFluH/G1yh/ssJ2tGE+qmpwpiCKx/FkIwJEUjf9veIV9+02NWLxGNw2Ho 5Y5VG1k23Q5owLVVGLGWkn7PeuAIaVRCo6MuGs6qlvv2y3aEf8A+wJLQI5vOG45/u3M9 ZodEr3F0hnrdl3igzGr9/3lSdK4eDPYdMe/xuC7UdpJOqQAnyNTZrsvmyeLYxz4ylVhc YTXmy6ASktKRsZz/C1l/TAvy+330f/XANGx1mFtIVjFexhv+om5hzaXKdqp1lFiM+6Le +xmg== Received: from [192.168.0.41] (97-118-125-210.hlrn.qwest.net. [97.118.125.210]) by smtp.gmail.com with ESMTPSA id i13sm7154909qkm.68.2019.05.14.14.32.13 for (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Tue, 14 May 2019 14:32:13 -0700 (PDT) To: gcc-patches From: Martin Sebor Subject: [PATCH 4/12] fix diagnostic quoting/spelling in the C front-end Message-ID: <872118de-6982-caef-0a0f-fb481994168f@gmail.com> Date: Tue, 14 May 2019 15:32:12 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 MIME-Version: 1.0 X-IsSubscribed: yes The attached patch fixes quoting, spelling, and other formatting issues in diagnostics issued by the C front-end and pointed out by the -Wformat-diag warning. Martin gcc/c/ChangeLog: * c-decl.c (start_decl): Quote keywords, operators, and types in diagnostics. (finish_decl): Same. * c-parser.c (c_parser_asm_statement): Same. (c_parser_conditional_expression): Same. (c_parser_transaction_cancel): Same. * c-typeck.c (c_common_type): Same. (build_conditional_expr): Same. (digest_init): Same. (process_init_element): Same. (build_binary_op): Same. diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index c8e7cd01d9e..11c0a421432 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -4887,7 +4887,7 @@ start_decl (struct c_declarator *declarator, struct c_declspecs *declspecs, switch (TREE_CODE (decl)) { case TYPE_DECL: - error ("typedef %qD is initialized (use __typeof__ instead)", decl); + error ("typedef %qD is initialized (use %<__typeof__%> instead)", decl); initialized = false; break; @@ -5282,7 +5282,7 @@ finish_decl (tree decl, location_t init_loc, tree init, && VAR_P (decl) && !C_DECL_REGISTER (decl) && !TREE_STATIC (decl)) - warning (0, "ignoring asm-specifier for non-static local " + warning (0, "ignoring %-specifier for non-static local " "variable %q+D", decl); else set_user_assembler_name (decl, asmspec); diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index 3aa85125cf1..e499a7c8beb 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -6401,7 +6401,7 @@ c_parser_asm_statement (c_parser *parser) case RID_VOLATILE: if (volatile_loc) { - error_at (loc, "duplicate asm qualifier %qE", token->value); + error_at (loc, "duplicate % qualifier %qE", token->value); inform (volatile_loc, "first seen here"); } else @@ -6412,7 +6412,7 @@ c_parser_asm_statement (c_parser *parser) case RID_INLINE: if (inline_loc) { - error_at (loc, "duplicate asm qualifier %qE", token->value); + error_at (loc, "duplicate % qualifier %qE", token->value); inform (inline_loc, "first seen here"); } else @@ -6423,7 +6423,7 @@ c_parser_asm_statement (c_parser *parser) case RID_GOTO: if (goto_loc) { - error_at (loc, "duplicate asm qualifier %qE", token->value); + error_at (loc, "duplicate % qualifier %qE", token->value); inform (goto_loc, "first seen here"); } else @@ -6433,7 +6433,7 @@ c_parser_asm_statement (c_parser *parser) case RID_CONST: case RID_RESTRICT: - error_at (loc, "%qE is not an asm qualifier", token->value); + error_at (loc, "%qE is not an % qualifier", token->value); c_parser_consume_token (parser); continue; @@ -6791,7 +6791,7 @@ c_parser_conditional_expression (c_parser *parser, struct c_expr *after, location_t middle_loc = c_parser_peek_token (parser)->location; pedwarn (middle_loc, OPT_Wpedantic, - "ISO C forbids omitting the middle term of a ?: expression"); + "ISO C forbids omitting the middle term of a % expression"); if (TREE_CODE (cond.value) == EXCESS_PRECISION_EXPR) { eptype = TREE_TYPE (cond.value); @@ -19825,8 +19825,8 @@ c_parser_transaction_cancel (c_parser *parser) && !is_tm_may_cancel_outer (current_function_decl)) { error_at (loc, "outer %<__transaction_cancel%> not " - "within outer %<__transaction_atomic%>"); - error_at (loc, " or a % function"); + "within outer %<__transaction_atomic%> or " + "a % function"); goto ret_error; } } diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index 4e443754002..5eff040e85d 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -743,17 +743,18 @@ c_common_type (tree t1, tree t2) { if (code1 == VECTOR_TYPE || code2 == VECTOR_TYPE) { - error ("can%'t mix operands of decimal float and vector types"); + error ("cannot mix operands of decimal floating and vector types"); return error_mark_node; } if (code1 == COMPLEX_TYPE || code2 == COMPLEX_TYPE) { - error ("can%'t mix operands of decimal float and complex types"); + error ("cannot mix operands of decimal floating and complex types"); return error_mark_node; } if (code1 == REAL_TYPE && code2 == REAL_TYPE) { - error ("can%'t mix operands of decimal float and other float types"); + error ("cannot mix operands of decimal floating " + "and other floating types"); return error_mark_node; } } @@ -5253,13 +5254,13 @@ build_conditional_expr (location_t colon_loc, tree ifexp, bool ifexp_bcp, /* OK */; else if (unsigned_op2) warning_at (op1_loc, OPT_Wsign_compare, - "operand of ?: changes signedness from " + "operand of % changes signedness from " "%qT to %qT due to unsignedness of other " "operand", TREE_TYPE (orig_op1), TREE_TYPE (orig_op2)); else warning_at (op2_loc, OPT_Wsign_compare, - "operand of ?: changes signedness from " + "operand of % changes signedness from " "%qT to %qT due to unsignedness of other " "operand", TREE_TYPE (orig_op2), TREE_TYPE (orig_op1)); @@ -7764,13 +7765,13 @@ digest_init (location_t init_loc, tree type, tree init, tree origtype, that is counted in the length of the constant. */ if (compare_tree_int (TYPE_SIZE_UNIT (type), len - unit) < 0) pedwarn_init (init_loc, 0, - ("initializer-string for array of chars " - "is too long")); + ("initializer-string for array of %qT " + "is too long"), typ1); else if (warn_cxx_compat && compare_tree_int (TYPE_SIZE_UNIT (type), len) < 0) warning_at (init_loc, OPT_Wc___compat, - ("initializer-string for array chars " - "is too long for C++")); + ("initializer-string for array of %qT " + "is too long for C++"), typ1); if (compare_tree_int (TYPE_SIZE_UNIT (type), len) < 0) { unsigned HOST_WIDE_INT size @@ -9888,7 +9889,7 @@ process_init_element (location_t loc, struct c_expr value, bool implicit, && integer_zerop (constructor_unfilled_index)) { if (constructor_stack->replacement_value.value) - error_init (loc, "excess elements in char array initializer"); + error_init (loc, "excess elements in % array initializer"); constructor_stack->replacement_value = value; return; } @@ -11937,7 +11938,7 @@ build_binary_op (location_t location, enum tree_code code, if (FLOAT_TYPE_P (type0) || FLOAT_TYPE_P (type1)) warning_at (location, OPT_Wfloat_equal, - "comparing floating point with == or != is unsafe"); + "comparing floating point with %<==%> or % is unsafe"); /* Result of comparison is always int, but don't convert the args to int! */ build_type = integer_type_node; From patchwork Tue May 14 21:32:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Sebor X-Patchwork-Id: 1099739 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-500691-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="um9tId28"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="B0AO1MNi"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 453WBn01GLz9sDn for ; Wed, 15 May 2019 07:33:20 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=QK8H1mliUJbOAFZ5ibCj+CNg3rMZ2X7B8/Ru2k8NDqJV3NeqJj ryYXZdX+xYSwJemWRfcJFNsgaLnuZpdfr2ubz71jw09x+L5zjaHso5tHaoIBSRs6 GuxqhOzpch6rO2PF1sfKrGQHrWzkrXkqpOzzVX5i3dua3epxaGtwJOnbQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=1KHMo+Xpy/H+2LV8N401p8GzSa8=; b=um9tId2873GV12JhtfCu sN4Wuq6gzOTmmAj0OM6nhsTtsm41DLO53p6cL/vRCZQfkYfGJcfpZFv0zcGPZkxk i99IgpxAki/YiE5/AEHtuW4rGCgth7gYHS+0yjepi6TsBBCWUCrEfdTABmNxEW/c filfIXLgNDuH4CGdZe4TTBA= Received: (qmail 39268 invoked by alias); 14 May 2019 21:32:29 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 39187 invoked by uid 89); 14 May 2019 21:32:29 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.9 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_STOCKGEN, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=badly, filenames, fpackstruct, dwarf2_debug X-HELO: mail-qt1-f169.google.com Received: from mail-qt1-f169.google.com (HELO mail-qt1-f169.google.com) (209.85.160.169) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 14 May 2019 21:32:24 +0000 Received: by mail-qt1-f169.google.com with SMTP id y42so866987qtk.6 for ; Tue, 14 May 2019 14:32:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:date:user-agent:mime-version :content-language; bh=FaPa6mzJUV7rQiYIKvb0r5vpmOkeLaFwQvZBRuV2Ll0=; b=B0AO1MNi5kV9UIIsyi3equmPBr0pxF+g+j7QgLmCcbHmEOqVVhLUDJsXDqKuBdB9nV C1uVdBc98qZUWZtyYvoEkKVWoUpLOZ3wdTV3sbJQYwQ4mw0M0ODEyOWHF/jenu0kXHb0 s4f4/20PMYW3c8k9Pzm3nu2/cwz9ECjuRV/B87+WkYm/+Ke7VSUXN5gW62qyzRIRJJcj ZdVt8/av5LZwA3aHTqqRXIcvRfii3HGC6znArTVNgrkPvkzhAChlF/+MpQTVnskEpyOS N1ahiq8mskjecyDrsQ/eGzyiaADbpzkcRi4Ob8U0aZNLrLM5Bnd8txv69WNNlAg7/j1h gQpg== Received: from [192.168.0.41] (97-118-125-210.hlrn.qwest.net. [97.118.125.210]) by smtp.gmail.com with ESMTPSA id x126sm5257826qkd.34.2019.05.14.14.32.21 for (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Tue, 14 May 2019 14:32:21 -0700 (PDT) To: gcc-patches From: Martin Sebor Subject: [PATCH 5/12] fix diagnostic quoting/spelling in c-family Message-ID: <5219f2c3-3ba3-e231-6897-d419032f54bd@gmail.com> Date: Tue, 14 May 2019 15:32:20 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 MIME-Version: 1.0 X-IsSubscribed: yes The attached patch fixes quoting, spelling, and other formatting issues in diagnostics issued from files in the c-family/ directory and pointed out by the -Wformat-diag warning. Martin gcc/c-family/ChangeLog: * c-attribs.c (handle_no_sanitize_attribute): Quote identifiers, keywords, operators, and types in diagnostics. (handle_scalar_storage_order_attribute): Same. (handle_mode_attribute): Same. (handle_visibility_attribute): Same. (handle_assume_aligned_attribute): Same. (handle_no_split_stack_attribute): Same. * c-common.c (shorten_compare): Same. (c_common_truthvalue_conversion): Same. (cb_get_source_date_epoch): Same. * c-common.h (GCC_DIAG_STYLE): Adjust. (GCC_DIAG_RAW_STYLE): New macro. * c-lex.c (cb_def_pragma): Quote keywords, operators, and types in diagnostics. (interpret_float): Same. * c-omp.c (c_finish_omp_for): Same. * c-opts.c (c_common_post_options): Same. * c-pch.c (c_common_pch_pragma): Same. * c-pragma.c (pop_alignment): Same. (handle_pragma_pack): Same. (apply_pragma_weak): Same. (handle_pragma_weak): Same. (handle_pragma_scalar_storage_order): Same. (handle_pragma_redefine_extname): Same. (add_to_renaming_pragma_list): Same. (maybe_apply_renaming_pragma): Same. (push_visibility): Same. (handle_pragma_visibility): Same. (handle_pragma_optimize): Same. (handle_pragma_message): Same. * c-warn.c (warn_for_omitted_condop): Same. (lvalue_error): Same. diff --git a/gcc/c-family/c-attribs.c b/gcc/c-family/c-attribs.c index 93b210eed9c..60e5d851586 100644 --- a/gcc/c-family/c-attribs.c +++ b/gcc/c-family/c-attribs.c @@ -891,7 +891,7 @@ handle_no_sanitize_attribute (tree *node, tree name, tree args, int, tree id = TREE_VALUE (args); if (TREE_CODE (id) != STRING_CST) { - error ("no_sanitize argument not a string"); + error ("%qE argument not a string", name); return NULL_TREE; } @@ -1418,8 +1418,8 @@ handle_scalar_storage_order_attribute (tree *node, tree name, tree args, if (BYTES_BIG_ENDIAN != WORDS_BIG_ENDIAN) { - error ("scalar_storage_order is not supported because endianness " - "is not uniform"); + error ("%qE attribute is not supported because endianness is not uniform", + name); return NULL_TREE; } @@ -1435,8 +1435,8 @@ handle_scalar_storage_order_attribute (tree *node, tree name, tree args, reverse = BYTES_BIG_ENDIAN; else { - error ("scalar_storage_order argument must be one of \"big-endian\"" - " or \"little-endian\""); + error ("attribute %qE argument must be one of %qs or %qs", + name, "big-endian", "little-endian"); return NULL_TREE; } @@ -1759,9 +1759,9 @@ handle_mode_attribute (tree *node, tree name, tree args, case MODE_VECTOR_ACCUM: case MODE_VECTOR_UACCUM: warning (OPT_Wattributes, "specifying vector types with " - "__attribute__ ((mode)) is deprecated"); - warning (OPT_Wattributes, - "use __attribute__ ((vector_size)) instead"); + "%<__attribute__ ((mode))%> is deprecated"); + inform (input_location, + "use %<__attribute__ ((vector_size))%> instead"); valid_mode = vector_mode_valid_p (mode); break; @@ -2671,7 +2671,8 @@ handle_visibility_attribute (tree *node, tree name, tree args, vis = VISIBILITY_PROTECTED; else { - error ("visibility argument must be one of \"default\", \"hidden\", \"protected\" or \"internal\""); + error ("attribute %qE argument must be one of %qs, %qs, %qs, or %qs", + name, "default", "hidden", "protected", "internal"); vis = VISIBILITY_DEFAULT; } @@ -2935,8 +2936,8 @@ handle_assume_aligned_attribute (tree *node, tree name, tree args, int, /* The misalignment specified by the second argument must be non-negative and less than the alignment. */ warning (OPT_Wattributes, - "%qE attribute argument %E is not in the range [0, %E)", - name, val, align); + "%qE attribute argument %E is not in the range %s, %E%c", + name, val, "[0", align, ')'); *no_add_attrs = true; return NULL_TREE; } @@ -3985,13 +3986,13 @@ handle_no_split_stack_attribute (tree *node, tree name, struct attribute_spec.handler. */ static tree -handle_returns_nonnull_attribute (tree *node, tree, tree, int, +handle_returns_nonnull_attribute (tree *node, tree name, tree, int, bool *no_add_attrs) { // Even without a prototype we still have a return type we can check. if (TREE_CODE (TREE_TYPE (*node)) != POINTER_TYPE) { - error ("returns_nonnull attribute on a function not returning a pointer"); + error ("%qE attribute on a function not returning a pointer", name); *no_add_attrs = true; } return NULL_TREE; diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 3c2f7a9d1c7..4cb2082959a 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -3063,14 +3063,16 @@ shorten_compare (location_t loc, tree *op0_ptr, tree *op1_ptr, case GE_EXPR: if (warn) warning_at (loc, OPT_Wtype_limits, - "comparison of unsigned expression >= 0 is always true"); + "comparison of unsigned expression in %<>= 0%> " + "is always true"); value = truthvalue_true_node; break; case LT_EXPR: if (warn) warning_at (loc, OPT_Wtype_limits, - "comparison of unsigned expression < 0 is always false"); + "comparison of unsigned expression in %<< 0%> " + "is always false"); value = truthvalue_false_node; break; @@ -3379,7 +3381,7 @@ c_common_truthvalue_conversion (location_t location, tree expr) if (TREE_CODE (TREE_TYPE (expr)) == INTEGER_TYPE && !TYPE_UNSIGNED (TREE_TYPE (expr))) warning_at (EXPR_LOCATION (expr), OPT_Wint_in_bool_context, - "%<<<%> in boolean context, did you mean %<<%> ?"); + "%<<<%> in boolean context, did you mean %<<%>?"); break; case COND_EXPR: @@ -3395,7 +3397,7 @@ c_common_truthvalue_conversion (location_t location, tree expr) && (!integer_onep (val1) || !integer_onep (val2))) warning_at (EXPR_LOCATION (expr), OPT_Wint_in_bool_context, - "?: using integer constants in boolean context, " + "% using integer constants in boolean context, " "the expression will always evaluate to %"); else if ((TREE_CODE (val1) == INTEGER_CST && !integer_zerop (val1) @@ -3404,7 +3406,7 @@ c_common_truthvalue_conversion (location_t location, tree expr) && !integer_zerop (val2) && !integer_onep (val2))) warning_at (EXPR_LOCATION (expr), OPT_Wint_in_bool_context, - "?: using integer constants in boolean context"); + "% using integer constants in boolean context"); } /* Distribute the conversion into the arms of a COND_EXPR. */ if (c_dialect_cxx ()) @@ -8257,9 +8259,9 @@ cb_get_source_date_epoch (cpp_reader *pfile ATTRIBUTE_UNUSED) if (errno != 0 || endptr == source_date_epoch || *endptr != '\0' || epoch < 0 || epoch > MAX_SOURCE_DATE_EPOCH) { - error_at (input_location, "environment variable SOURCE_DATE_EPOCH must " + error_at (input_location, "environment variable %qs must " "expand to a non-negative integer less than or equal to %wd", - MAX_SOURCE_DATE_EPOCH); + "SOURCE_DATE_EPOCH", MAX_SOURCE_DATE_EPOCH); return (time_t) -1; } diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h index 1cf2cae6395..9d067028416 100644 --- a/gcc/c-family/c-common.h +++ b/gcc/c-family/c-common.h @@ -39,7 +39,10 @@ framework extensions, you must include this file before diagnostic-core.h \ never after. #endif #ifndef GCC_DIAG_STYLE -#define GCC_DIAG_STYLE __gcc_cdiag__ +# define GCC_DIAG_STYLE __gcc_cdiag__ +#endif +#ifndef GCC_DIAG_RAW_STYLE +# define GCC_DIAG_RAW_STYLE __gcc_cdiag_raw__ #endif #include "diagnostic-core.h" diff --git a/gcc/c-family/c-lex.c b/gcc/c-family/c-lex.c index 0a368a33a58..851fd704e5d 100644 --- a/gcc/c-family/c-lex.c +++ b/gcc/c-family/c-lex.c @@ -258,7 +258,7 @@ cb_def_pragma (cpp_reader *pfile, location_t loc) name = cpp_token_as_text (pfile, s); } - warning_at (fe_loc, OPT_Wunknown_pragmas, "ignoring #pragma %s %s", + warning_at (fe_loc, OPT_Wunknown_pragmas, "ignoring %<#pragma %s %s%>", space, name); } } @@ -818,7 +818,7 @@ interpret_float (const cpp_token *token, unsigned int flags, if (((flags & CPP_N_HEX) == 0) && ((flags & CPP_N_IMAGINARY) == 0)) { warning (OPT_Wunsuffixed_float_constants, - "unsuffixed float constant"); + "unsuffixed floating constant"); if (float_const_decimal64_p ()) flags |= CPP_N_DFLOAT; } diff --git a/gcc/c-family/c-omp.c b/gcc/c-family/c-omp.c index 16e71981887..5645e9d4fda 100644 --- a/gcc/c-family/c-omp.c +++ b/gcc/c-family/c-omp.c @@ -974,7 +974,7 @@ c_finish_omp_for (location_t locus, enum tree_code code, tree declv, { error_at (elocus, "increment is not constant 1 or " - "-1 for != condition"); + "-1 for % condition"); fail = true; } } @@ -992,7 +992,7 @@ c_finish_omp_for (location_t locus, enum tree_code code, tree declv, { error_at (elocus, "increment is not constant 1 or -1 for" - " != condition"); + " % condition"); fail = true; } } diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c index bc7ea176909..954b6a494f8 100644 --- a/gcc/c-family/c-opts.c +++ b/gcc/c-family/c-opts.c @@ -1022,8 +1022,8 @@ c_common_post_options (const char **pfilename) warn_return_type = 1; if (num_in_fnames > 1) - error ("too many filenames given. Type %s --help for usage", - progname); + error ("too many filenames given; type %<%s %s%> for usage", + progname, "--help"); if (flag_preprocess_only) { @@ -1057,7 +1057,7 @@ c_common_post_options (const char **pfilename) debug formats we warn here and refuse to load any PCH files. */ if (write_symbols != NO_DEBUG && write_symbols != DWARF2_DEBUG) warning (OPT_Wdeprecated, - "the \"%s\" debug format cannot be used with " + "the %qs debug format cannot be used with " "pre-compiled headers", debug_type_names[write_symbols]); } else if (write_symbols != NO_DEBUG && write_symbols != DWARF2_DEBUG) diff --git a/gcc/c-family/c-pch.c b/gcc/c-family/c-pch.c index 316fb84f429..2fa7a52ae1e 100644 --- a/gcc/c-family/c-pch.c +++ b/gcc/c-family/c-pch.c @@ -406,9 +406,9 @@ c_common_pch_pragma (cpp_reader *pfile, const char *name) if (!cpp_get_options (pfile)->preprocessed) { - error ("pch_preprocess pragma should only be used " + error ("% pragma should only be used " "with %<-fpreprocessed%>"); - inform (input_location, "use #include instead"); + inform (input_location, "use %<#include%> instead"); return; } diff --git a/gcc/c-family/c-pragma.c b/gcc/c-family/c-pragma.c index 6b8ada59460..480d98efd1e 100644 --- a/gcc/c-family/c-pragma.c +++ b/gcc/c-family/c-pragma.c @@ -91,7 +91,8 @@ pop_alignment (tree id) align_stack * entry; if (alignment_stack == NULL) - GCC_BAD ("#pragma pack (pop) encountered without matching #pragma pack (push)"); + GCC_BAD ("%<#pragma pack (pop)%> encountered without matching " + "%<#pragma pack (push)%>"); /* If we got an identifier, strip away everything above the target entry so that the next step will restore the state just below it. */ @@ -104,8 +105,9 @@ pop_alignment (tree id) break; } if (entry == NULL) - warning (OPT_Wpragmas, "\ -#pragma pack(pop, %E) encountered without matching #pragma pack(push, %E)" + warning (OPT_Wpragmas, + "%<#pragma pack(pop, %E)%> encountered without matching " + "%<#pragma pack(push, %E)%>" , id, id); } @@ -197,7 +199,7 @@ handle_pragma_pack (cpp_reader * ARG_UNUSED (dummy)) warning (OPT_Wpragmas, "junk at end of %<#pragma pack%>"); if (flag_pack_struct) - GCC_BAD ("#pragma pack has no effect with %<-fpack-struct%> - ignored"); + GCC_BAD ("%<#pragma pack%> has no effect with %<-fpack-struct%> - ignored"); if (action != pop) switch (align) @@ -257,7 +259,7 @@ apply_pragma_weak (tree decl, tree value) && !DECL_WEAK (decl) /* Don't complain about a redundant #pragma. */ && DECL_ASSEMBLER_NAME_SET_P (decl) && TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))) - warning (OPT_Wpragmas, "applying #pragma weak %q+D after first use " + warning (OPT_Wpragmas, "applying %<#pragma weak %+D%> after first use " "results in unspecified behavior", decl); declare_weak (decl); @@ -354,12 +356,12 @@ handle_pragma_weak (cpp_reader * ARG_UNUSED (dummy)) value = 0; if (pragma_lex (&name) != CPP_NAME) - GCC_BAD ("malformed #pragma weak, ignored"); + GCC_BAD ("malformed %<#pragma weak%>, ignored"); t = pragma_lex (&x); if (t == CPP_EQ) { if (pragma_lex (&value) != CPP_NAME) - GCC_BAD ("malformed #pragma weak, ignored"); + GCC_BAD ("%, ignored"); t = pragma_lex (&x); } if (t != CPP_EOF) @@ -417,7 +419,7 @@ handle_pragma_scalar_storage_order (cpp_reader *ARG_UNUSED(dummy)) if (BYTES_BIG_ENDIAN != WORDS_BIG_ENDIAN) { - error ("scalar_storage_order is not supported because endianness " + error ("% is not supported because endianness " "is not uniform"); return; } @@ -495,9 +497,9 @@ handle_pragma_redefine_extname (cpp_reader * ARG_UNUSED (dummy)) bool found; if (pragma_lex (&oldname) != CPP_NAME) - GCC_BAD ("malformed #pragma redefine_extname, ignored"); + GCC_BAD ("malformed %<#pragma redefine_extname%>, ignored"); if (pragma_lex (&newname) != CPP_NAME) - GCC_BAD ("malformed #pragma redefine_extname, ignored"); + GCC_BAD ("malformed %<#pragma redefine_extname%>, ignored"); t = pragma_lex (&x); if (t != CPP_EOF) warning (OPT_Wpragmas, "junk at end of %<#pragma redefine_extname%>"); @@ -528,8 +530,8 @@ handle_pragma_redefine_extname (cpp_reader * ARG_UNUSED (dummy)) name = targetm.strip_name_encoding (name); if (!id_equal (newname, name)) - warning (OPT_Wpragmas, "#pragma redefine_extname ignored due to " - "conflict with previous rename"); + warning (OPT_Wpragmas, "%<#pragma redefine_extname%> " + "ignored due to conflict with previous rename"); } else symtab->change_decl_assembler_name (decl, newname); @@ -556,8 +558,8 @@ add_to_renaming_pragma_list (tree oldname, tree newname) if (oldname == p->oldname) { if (p->newname != newname) - warning (OPT_Wpragmas, "#pragma redefine_extname ignored due to " - "conflict with previous #pragma redefine_extname"); + warning (OPT_Wpragmas, "%<#pragma redefine_extname%> ignored due to " + "conflict with previous %<#pragma redefine_extname%>"); return; } @@ -592,7 +594,7 @@ maybe_apply_renaming_pragma (tree decl, tree asmname) oldname = targetm.strip_name_encoding (oldname); if (asmname && strcmp (TREE_STRING_POINTER (asmname), oldname)) - warning (OPT_Wpragmas, "asm declaration ignored due to " + warning (OPT_Wpragmas, "% declaration ignored due to " "conflict with previous rename"); /* Take any pending redefine_extname off the list. */ @@ -601,8 +603,8 @@ maybe_apply_renaming_pragma (tree decl, tree asmname) { /* Only warn if there is a conflict. */ if (!id_equal (p->newname, oldname)) - warning (OPT_Wpragmas, "#pragma redefine_extname ignored due to " - "conflict with previous rename"); + warning (OPT_Wpragmas, "%<#pragma redefine_extname%> ignored " + "due to conflict with previous rename"); pending_redefine_extname->unordered_remove (ix); break; @@ -623,8 +625,8 @@ maybe_apply_renaming_pragma (tree decl, tree asmname) { if (strcmp (TREE_STRING_POINTER (asmname), IDENTIFIER_POINTER (newname)) != 0) - warning (OPT_Wpragmas, "#pragma redefine_extname ignored due to " - "conflict with __asm__ declaration"); + warning (OPT_Wpragmas, "%<#pragma redefine_extname%> ignored " + "due to conflict with % declaration"); return asmname; } @@ -684,7 +686,8 @@ push_visibility (const char *str, int kind) else if (!strcmp (str, "protected")) default_visibility = VISIBILITY_PROTECTED; else - GCC_BAD ("#pragma GCC visibility push() must specify default, internal, hidden or protected"); + GCC_BAD ("%<#pragma GCC visibility push()%> must specify %, " + "%, % or %"); visibility_options.inpragma = 1; } @@ -726,7 +729,8 @@ handle_pragma_visibility (cpp_reader *dummy ATTRIBUTE_UNUSED) action = pop; } if (bad == action) - GCC_BAD ("#pragma GCC visibility must be followed by push or pop"); + GCC_BAD ("%<#pragma GCC visibility%> must be followed by % " + "or %"); else { if (pop == action) @@ -740,7 +744,7 @@ handle_pragma_visibility (cpp_reader *dummy ATTRIBUTE_UNUSED) GCC_BAD ("missing %<(%> after %<#pragma GCC visibility push%> - ignored"); token = pragma_lex (&x); if (token != CPP_NAME) - GCC_BAD ("malformed #pragma GCC visibility push"); + GCC_BAD ("malformed %<#pragma GCC visibility push%>"); else push_visibility (IDENTIFIER_POINTER (x), 0); if (pragma_lex (&x) != CPP_CLOSE_PAREN) @@ -860,7 +864,7 @@ handle_pragma_target(cpp_reader *ARG_UNUSED(dummy)) if (cfun) { - error ("#pragma GCC option is not allowed inside functions"); + error ("%<#pragma GCC option%> is not allowed inside functions"); return; } @@ -906,7 +910,7 @@ handle_pragma_target(cpp_reader *ARG_UNUSED(dummy)) if (token != CPP_EOF) { - error ("#pragma GCC target string... is badly formed"); + error ("%<#pragma GCC target%> string is badly formed"); return; } @@ -929,7 +933,7 @@ handle_pragma_optimize (cpp_reader *ARG_UNUSED(dummy)) if (cfun) { - error ("#pragma GCC optimize is not allowed inside functions"); + error ("%<#pragma GCC optimize%> is not allowed inside functions"); return; } @@ -974,7 +978,7 @@ handle_pragma_optimize (cpp_reader *ARG_UNUSED(dummy)) if (token != CPP_EOF) { - error ("#pragma GCC optimize string... is badly formed"); + error ("%<#pragma GCC optimize%> string is badly formed"); return; } @@ -1147,7 +1151,8 @@ handle_pragma_message (cpp_reader *ARG_UNUSED(dummy)) warning (OPT_Wpragmas, "junk at end of %<#pragma message%>"); if (TREE_STRING_LENGTH (message) > 1) - inform (input_location, "#pragma message: %s", TREE_STRING_POINTER (message)); + inform (input_location, "%<#pragma message: %s%>", + TREE_STRING_POINTER (message)); } /* Mark whether the current location is valid for a STDC pragma. */ diff --git a/gcc/c-family/c-warn.c b/gcc/c-family/c-warn.c index f95eba96a70..fa7b6ddea55 100644 --- a/gcc/c-family/c-warn.c +++ b/gcc/c-family/c-warn.c @@ -1663,7 +1663,7 @@ warn_for_omitted_condop (location_t location, tree cond) || (TREE_TYPE (cond) != NULL_TREE && TREE_CODE (TREE_TYPE (cond)) == BOOLEAN_TYPE)) warning_at (location, OPT_Wparentheses, - "the omitted middle operand in ?: will always be %, " + "the omitted middle operand in % will always be %, " "suggest explicit middle operand"); } @@ -1762,7 +1762,7 @@ lvalue_error (location_t loc, enum lvalue_use use) error_at (loc, "lvalue required as unary %<&%> operand"); break; case lv_asm: - error_at (loc, "lvalue required in asm statement"); + error_at (loc, "lvalue required in % statement"); break; default: gcc_unreachable (); diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt index 916cc67b453..046d489f7eb 100644 From patchwork Tue May 14 21:32:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Sebor X-Patchwork-Id: 1099741 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-500693-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="DtKmXC+9"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="hX2iFuiF"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 453WCJ300cz9sNd for ; Wed, 15 May 2019 07:33:48 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=p+dSdZp1+uRaOxYi9SwpNSKw4nvqw5eD4FAxAdf/WVHBMhKmH0 Xij2+WYRlk2JlgQtbnQYUjOPujjv2KAtEyMnr206CUIc9JNQ6dt1q4P9jqw2aEqz 4UNYXLotCsWNfLvHwhXXEgisN4DVI9OGbKOVNjt3+CVhMMYZyzu0qzISM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=O2JSKkHYux1mS5REsoBfvg9Ny/k=; b=DtKmXC+9j2uap4GlY6hn YgMPZPdu+FA5raZNv3vKOvPopUEN+3jxeXaIcnHbLrmKb/2bytsI83N181wpPUOh Y9IDRwvhD0Hd8QaUzOe3AF9GBZA/bkakOvFpuz4BXchNlyhwwl6dZ8x7lga6M8Ag +JZ8svovqiyE43XTsLfnKCA= Received: (qmail 40461 invoked by alias); 14 May 2019 21:32:42 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 40383 invoked by uid 89); 14 May 2019 21:32:41 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-20.2 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=Break, specializing X-HELO: mail-qt1-f177.google.com Received: from mail-qt1-f177.google.com (HELO mail-qt1-f177.google.com) (209.85.160.177) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 14 May 2019 21:32:31 +0000 Received: by mail-qt1-f177.google.com with SMTP id i26so832767qtr.10 for ; Tue, 14 May 2019 14:32:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:date:user-agent:mime-version :content-language; bh=9kV7IYcNkmtKgqAr+qGm+P9ZfV/X+6tH6NafBoeo5Lo=; b=hX2iFuiFtdLycnolsVP/9kF7Nr8ZjciOIR2moq5CoYm/5SHOFguQ7kZ1xJNm2azuQW Ur0YbidHj98bcRxzJfOcP1YLU8OGy/VZFE3PLfs8JWbxZPQPwEl0XjBIQgQ5PmYAKhL9 HCS+HohhFyyBmrqIFVhHWTktPjFqkF881iMhZB2LrPsoJud/UuDEtLqY+0OCE77zbh/N RpXSl6p5frfRP4jsalwwxThyxJiRLMSX6ZS/AsHpZzJHhAmCZW19sWC09IEyvyBCL4eq 6ufGLS/OO38uS+4D6NPdhwTt7lbZciV5eiOgOIiKTxU2TxfMjYmla4rapbrnigFad54k X97g== Received: from [192.168.0.41] (97-118-125-210.hlrn.qwest.net. [97.118.125.210]) by smtp.gmail.com with ESMTPSA id d16sm102917qtd.73.2019.05.14.14.32.28 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Tue, 14 May 2019 14:32:28 -0700 (PDT) To: gcc-patches , Jason Merrill From: Martin Sebor Subject: [PATCH 6/12] fix diagnostic quoting/spelling in C++ Message-ID: <933acc02-8ef9-bc35-eb99-72d0d4c5ef34@gmail.com> Date: Tue, 14 May 2019 15:32:27 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 MIME-Version: 1.0 X-IsSubscribed: yes The attached patch fixes quoting, spelling, and other formatting issues in diagnostics issued by the C++ front-end and pointed out by the -Wformat-diag warning. Martin gcc/cp/ChangeLog: * call.c (print_z_candidate): Wrap diagnostic text in a gettext macro. Adjust. (print_z_candidates): Same. (build_conditional_expr_1): Quote keywords, operators, and types in diagnostics. (build_op_delete_call): Same. (maybe_print_user_conv_context): Wrap diagnostic text in a gettext macro. (convert_like_real): Same. (convert_arg_to_ellipsis): Quote keywords, operators, and types in diagnostics. (build_over_call): Same. (joust): Break up an overlong line. Wrap diagnostic text in a gettext macro. * constexpr.c (cxx_eval_check_shift_p): Spell out >= in English. (cxx_eval_constant_expression): Quote keywords, operators, and types in diagnostics. (potential_constant_expression_1): Same. * cp-gimplify.c (cp_genericize_r): Same. * cp-tree.h (GCC_DIAG_STYLE): Adjust. (GCC_DIAG_RAW_STYLE): New macro. * cvt.c (maybe_warn_nodiscard): Quote keywords, operators, and types in diagnostics. (type_promotes_to): Same. * decl.c (check_previous_goto_1): Same. (check_goto): Same. (start_decl): Same. (cp_finish_decl): Avoid parenthesizing a sentence for consistency. (grok_op_properties): Quote keywords, operators, and types in diagnostics. * decl2.c (grokfield): Same. (coerce_delete_type): Same. * except.c (is_admissible_throw_operand_or_catch_parameter): Same. * friend.c (do_friend): Quote C++ tokens. * init.c (build_new_1): Quote keywords, operators, and types in diagnostics. (build_vec_delete_1): Same. (build_delete): Same. * lex.c (parse_strconst_pragma): Same. (handle_pragma_implementation): Same. (unqualified_fn_lookup_error): Same. * mangle.c (write_type): Same. * method.c (defaulted_late_check): Avoid two consecutive punctuators. * name-lookup.c (cp_binding_level_debug): Remove a trailing newline. (pop_everything): Same. * parser.c (cp_lexer_start_debugging): Quote a macro name. in a diagnostic (cp_lexer_stop_debugging): Same. (cp_parser_userdef_numeric_literal): Quote a C++ header name in a diagnostic. (cp_parser_nested_name_specifier_opt): Quote keywords, operators, and types in diagnostics. (cp_parser_question_colon_clause): Same. (cp_parser_asm_definition): Same. (cp_parser_init_declarator): Same. (cp_parser_template_declaration_after_parameters): Avoid capitalizing a sentence in a diagnostic. (cp_parser_omp_declare_reduction): Quote keywords, operators, and types in diagnostics. (cp_parser_transaction): Same. * pt.c (maybe_process_partial_specialization): Replace second call to permerror with inform for consistency with other uses. (expand_integer_pack): Quote keywords, operators, and types in diagnostics. * rtti.c (get_typeid): Quote keywords, operators, and types in diagnostics. (build_dynamic_cast_1): Same. * semantics.c (finish_asm_stmt): Same. (finish_label_decl): Same. (finish_bases): Same. (finish_offsetof): Same. (cp_check_omp_declare_reduction): Same. (finish_decltype_type): Same. * tree.c (handle_init_priority_attribute): Same. Add detail to diagnostics. (maybe_warn_zero_as_null_pointer_constant): Same. * typeck.c (cp_build_binary_op): Quote keywords, operators, and types in diagnostics. (cp_build_unary_op): Same. (check_for_casting_away_constness): Same. (build_static_cast): Same. (build_const_cast_1): Same. (maybe_warn_about_returning_address_of_local): Same. (check_return_expr): Same. * typeck2.c (abstract_virtuals_error_sfinae): Same. (digest_init_r): Replace a tab with spaces in a diagnostic. (build_functional_cast): Quote keywords, operators, and types in diagnostics. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 00cb3993471..c2f17dc3750 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -3603,7 +3603,7 @@ print_z_candidate (location_t loc, const char *msgstr, { const char *msg = (msgstr == NULL ? "" - : ACONCAT ((msgstr, " ", NULL))); + : ACONCAT ((_(msgstr), " ", NULL))); tree fn = candidate->fn; if (flag_new_inheriting_ctors) fn = strip_inheriting_ctors (fn); @@ -3613,24 +3613,27 @@ print_z_candidate (location_t loc, const char *msgstr, { cloc = loc; if (candidate->num_convs == 3) - inform (cloc, "%s%<%D(%T, %T, %T)%> ", msg, fn, + inform (cloc, "%s%<%D(%T, %T, %T)%> %s", msg, fn, candidate->convs[0]->type, candidate->convs[1]->type, - candidate->convs[2]->type); + candidate->convs[2]->type, + ""); else if (candidate->num_convs == 2) - inform (cloc, "%s%<%D(%T, %T)%> ", msg, fn, + inform (cloc, "%s%<%D(%T, %T)%> %s", msg, fn, candidate->convs[0]->type, - candidate->convs[1]->type); + candidate->convs[1]->type, + ""); else - inform (cloc, "%s%<%D(%T)%> ", msg, fn, - candidate->convs[0]->type); + inform (cloc, "%s%<%D(%T)%> %s", msg, fn, + candidate->convs[0]->type, + ""); } else if (TYPE_P (fn)) - inform (cloc, "%s%qT ", msg, fn); + inform (cloc, "%s%qT %s", msg, fn, ""); else if (candidate->viable == -1) - inform (cloc, "%s%#qD ", msg, fn); + inform (cloc, "%s%#qD %s", msg, fn, ""); else if (DECL_DELETED_FN (fn)) - inform (cloc, "%s%#qD ", msg, fn); + inform (cloc, "%s%#qD %s", msg, fn, ""); else inform (cloc, "%s%#qD", msg, fn); if (fn != candidate->fn) @@ -3763,7 +3766,7 @@ print_z_candidates (location_t loc, struct z_candidate *candidates) } for (; candidates; candidates = candidates->next) - print_z_candidate (loc, "candidate:", candidates); + print_z_candidate (loc, N_("candidate:"), candidates); } /* USER_SEQ is a user-defined conversion sequence, beginning with a @@ -5006,7 +5009,8 @@ build_conditional_expr_1 (const op_location_t &loc, { if (complain & tf_error) pedwarn (loc, OPT_Wpedantic, - "ISO C++ forbids omitting the middle term of a ?: expression"); + "ISO C++ forbids omitting the middle term of " + "a % expression"); if ((complain & tf_warning) && !truth_value_p (TREE_CODE (arg1))) warn_for_omitted_condop (loc, arg1); @@ -5279,7 +5283,8 @@ build_conditional_expr_1 (const op_location_t &loc, { if (complain & tf_error) { - error_at (loc, "operands to ?: have different types %qT and %qT", + error_at (loc, "operands to % have different types " + "%qT and %qT", arg2_type, arg3_type); if (conv2 && !conv2->bad_p && conv3 && !conv3->bad_p) inform (loc, " and each type can be converted to the other"); @@ -5395,7 +5400,7 @@ build_conditional_expr_1 (const op_location_t &loc, if (!any_viable_p) { if (complain & tf_error) - error_at (loc, "operands to ?: have different types %qT and %qT", + error_at (loc, "operands to % have different types %qT and %qT", arg2_type, arg3_type); return error_mark_node; } @@ -5542,7 +5547,7 @@ build_conditional_expr_1 (const op_location_t &loc, if (!result_type) { if (complain & tf_error) - error_at (loc, "operands to ?: have different types %qT and %qT", + error_at (loc, "operands to % have different types %qT and %qT", arg2_type, arg3_type); return error_mark_node; } @@ -6492,10 +6497,10 @@ build_op_delete_call (enum tree_code code, tree addr, tree size, { const char *const msg1 = G_("exception cleanup for this placement new selects " - "non-placement operator delete"); + "non-placement %"); const char *const msg2 = G_("%qD is a usual (non-placement) deallocation " - "function in C++14 (or with -fsized-deallocation)"); + "function in C++14 (or with %<-fsized-deallocation%>)"); /* But if the class has an operator delete (void *), then that is the usual deallocation function, so we shouldn't complain @@ -6892,7 +6897,7 @@ maybe_print_user_conv_context (conversion *convs) for (conversion *t = convs; t; t = next_conversion (t)) if (t->kind == ck_user) { - print_z_candidate (0, " after user-defined conversion:", + print_z_candidate (0, N_(" after user-defined conversion:"), t->cand); break; } @@ -7005,7 +7010,7 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum, "from %qH to %qI", TREE_TYPE (expr), totype); if (complained) - print_z_candidate (loc, "candidate is:", t->cand); + print_z_candidate (loc, N_("candidate is:"), t->cand); expr = convert_like_real (t, expr, fn, argnum, /*issue_conversion_warnings=*/false, /*c_cast_p=*/false, @@ -7517,8 +7522,9 @@ convert_arg_to_ellipsis (tree arg, tsubst_flags_t complain) if (abi_version_crosses (6) && TYPE_MODE (TREE_TYPE (prom)) != TYPE_MODE (arg_type) && (complain & tf_warning)) - warning_at (loc, OPT_Wabi, "scoped enum %qT passed through ... as " - "%qT before %<-fabi-version=6%>, %qT after", arg_type, + warning_at (loc, OPT_Wabi, "scoped enum %qT passed through %<...%>" + "as %qT before %<-fabi-version=6%>, %qT after", + arg_type, TREE_TYPE (prom), ENUM_UNDERLYING_TYPE (arg_type)); if (!abi_version_at_least (6)) arg = prom; @@ -8596,8 +8602,8 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain) if (is_std_init_list (type) && conv_binds_ref_to_prvalue (convs[1])) warning_at (loc, OPT_Winit_list_lifetime, - "assignment from temporary initializer_list does not " - "extend the lifetime of the underlying array"); + "assignment from temporary % does " + "not extend the lifetime of the underlying array"); arg = cp_build_fold_indirect_ref (arg); val = build2 (MODIFY_EXPR, TREE_TYPE (to), to, arg); } @@ -10745,7 +10751,8 @@ joust (struct z_candidate *cand1, struct z_candidate *cand2, bool warn, && warning (OPT_Wconversion, " for conversion from %qH to %qI", source, w->second_conv->type)) { - inform (input_location, " because conversion sequence for the argument is better"); + inform (input_location, " because conversion sequence " + "for the argument is better"); } } else @@ -11031,8 +11038,8 @@ tweak: "though the worst conversion for the first is " "better than the worst conversion for the second:")) { - print_z_candidate (input_location, _("candidate 1:"), w); - print_z_candidate (input_location, _("candidate 2:"), l); + print_z_candidate (input_location, N_("candidate 1:"), w); + print_z_candidate (input_location, N_("candidate 2:"), l); } } else diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index 8ae0fd5715f..13b4da49f66 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -2020,9 +2020,9 @@ cxx_eval_check_shift_p (location_t loc, const constexpr_ctx *ctx, if (compare_tree_int (rhs, uprec) >= 0) { if (!ctx->quiet) - permerror (loc, "right operand of shift expression %q+E is >= than " - "the precision of the left operand", - build2_loc (loc, code, type, lhs, rhs)); + permerror (loc, "right operand of shift expression %q+E is greater " + "than or equal to the precision %wu of the left operand", + build2_loc (loc, code, type, lhs, rhs), uprec); return (!flag_permissive || ctx->quiet); } @@ -4420,7 +4420,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t, if (!ctx->quiet) error_at (cp_expr_loc_or_loc (t, input_location), "% evaluation operation count exceeds limit of " - "%wd (use -fconstexpr-ops-limit= to increase the limit)", + "%wd (use %<-fconstexpr-ops-limit=%> to increase the limit)", constexpr_ops_limit); *ctx->constexpr_ops_count = INTTYPE_MINIMUM (HOST_WIDE_INT); *non_constant_p = true; @@ -4957,7 +4957,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t, { if (!ctx->quiet) error_at (cp_expr_loc_or_loc (t, input_location), - "a reinterpret_cast is not a constant expression"); + "% is not a constant expression"); *non_constant_p = true; return t; } @@ -6116,7 +6116,7 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now, if (REINTERPRET_CAST_P (t)) { if (flags & tf_error) - error_at (loc, "a reinterpret_cast is not a constant expression"); + error_at (loc, "% is not a constant expression"); return false; } /* FALLTHRU */ @@ -6135,7 +6135,8 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now, && !integer_zerop (from)) { if (flags & tf_error) - error_at (loc, "reinterpret_cast from integer to pointer"); + error_at (loc, + "% from integer to pointer"); return false; } } @@ -6389,7 +6390,8 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now, /* In C++2a virtual calls can be constexpr, don't give up yet. */ return true; else if (flags & tf_error) - error_at (loc, "virtual functions cannot be constexpr before C++2a"); + error_at (loc, + "virtual functions cannot be % before C++2a"); return false; case TYPEID_EXPR: @@ -6401,7 +6403,7 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now, && TYPE_POLYMORPHIC_P (TREE_TYPE (e))) { if (flags & tf_error) - error_at (loc, "typeid-expression is not a constant expression " + error_at (loc, "% is not a constant expression " "because %qE is of polymorphic type", e); return false; } diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c index 4e63a4a6944..6edefbf9933 100644 --- a/gcc/cp/cp-gimplify.c +++ b/gcc/cp/cp-gimplify.c @@ -1466,10 +1466,10 @@ cp_genericize_r (tree *stmt_p, int *walk_subtrees, void *data) { auto_diagnostic_group d; if (warning_at (loc, OPT_Wterminate, - "throw will always call terminate()") + "% will always call %") && cxx_dialect >= cxx11 && DECL_DESTRUCTOR_P (current_function_decl)) - inform (loc, "in C++11 destructors default to noexcept"); + inform (loc, "in C++11 destructors default to %"); } } else @@ -1481,8 +1481,8 @@ cp_genericize_r (tree *stmt_p, int *walk_subtrees, void *data) && (get_defaulted_eh_spec (current_function_decl) == empty_except_spec)) warning_at (loc, OPT_Wc__11_compat, - "in C++11 this throw will terminate because " - "destructors default to noexcept"); + "in C++11 this % will call % " + "because destructors default to %"); } } break; diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 827b471aa80..90a0b4cf6b9 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -30,7 +30,10 @@ along with GCC; see the file COPYING3. If not see diagnostic-core.h, not after. We override the definition of GCC_DIAG_STYLE in c-common.h. */ #undef GCC_DIAG_STYLE -#define GCC_DIAG_STYLE __gcc_cxxdiag__ +#define GCC_DIAG_STYLE __gcc_cxxdiag__ +#undef GCC_DIAG_RAW_STYLE +#define GCC_DIAG_RAW_STYLE __gcc_cxxdiag_raw__ + #if defined(GCC_DIAGNOSTIC_CORE_H) || defined (GCC_C_COMMON_H) #error \ In order for the format checking to accept the C++ front end diagnostic \ diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c index 3d409279f22..3c3ee11eed1 100644 --- a/gcc/cp/cvt.c +++ b/gcc/cp/cvt.c @@ -1060,14 +1060,14 @@ maybe_warn_nodiscard (tree expr, impl_conv_void implicit) auto_diagnostic_group d; if (warning_at (loc, OPT_Wunused_result, "ignoring return value of %qD, " - "declared with attribute warn_unused_result", + "declared with attribute %", fn)) inform (DECL_SOURCE_LOCATION (fn), "declared here"); } else warning_at (loc, OPT_Wunused_result, "ignoring return value of function " - "declared with attribute warn_unused_result"); + "declared with attribute %"); } } @@ -1920,7 +1920,7 @@ type_promotes_to (tree type) { if (abi_version_crosses (6) && TYPE_MODE (prom) != TYPE_MODE (type)) - warning (OPT_Wabi, "scoped enum %qT passed through ... as " + warning (OPT_Wabi, "scoped enum %qT passed through %<...%> as " "%qT before %<-fabi-version=6%>, %qT after", type, prom, ENUM_UNDERLYING_TYPE (type)); if (!abi_version_at_least (6)) diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 86cfcbe0db5..edfa785ee25 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -3228,32 +3228,32 @@ check_previous_goto_1 (tree decl, cp_binding_level* level, tree names, { case sk_try: if (!saw_eh) - inf = N_("enters try block"); + inf = G_(" enters % block"); saw_eh = true; break; case sk_catch: if (!saw_eh) - inf = N_("enters catch block"); + inf = G_(" enters % block"); saw_eh = true; break; case sk_omp: if (!saw_omp) - inf = N_("enters OpenMP structured block"); + inf = G_(" enters OpenMP structured block"); saw_omp = true; break; case sk_transaction: if (!saw_tm) - inf = N_("enters synchronized or atomic statement"); + inf = G_(" enters synchronized or atomic statement"); saw_tm = true; break; case sk_block: if (!saw_cxif && level_for_constexpr_if (b->level_chain)) { - inf = N_("enters constexpr if statement"); + inf = G_(" enters % statement"); loc = EXPR_LOCATION (b->level_chain->this_entity); saw_cxif = true; } @@ -3269,7 +3269,7 @@ check_previous_goto_1 (tree decl, cp_binding_level* level, tree names, complained = identify_goto (decl, input_location, locus, DK_ERROR); identified = 2; if (complained) - inform (loc, " %s", inf); + inform (loc, inf); } } @@ -3364,7 +3364,7 @@ check_goto (tree decl) identified = 2; } if (complained) - inform (DECL_SOURCE_LOCATION (bad), " enters catch block"); + inform (DECL_SOURCE_LOCATION (bad), " enters % block"); saw_catch = true; } else if (complained) @@ -3382,13 +3382,13 @@ check_goto (tree decl) if (complained) { if (ent->in_try_scope) - inform (input_location, " enters try block"); + inform (input_location, " enters % block"); else if (ent->in_catch_scope && !saw_catch) - inform (input_location, " enters catch block"); + inform (input_location, " enters % block"); else if (ent->in_transaction_scope) inform (input_location, " enters synchronized or atomic statement"); else if (ent->in_constexpr_if) - inform (input_location, " enters % if statement"); + inform (input_location, " enters % statement"); } if (ent->in_omp_scope) @@ -5078,7 +5078,8 @@ start_decl (const cp_declarator *declarator, && TREE_CODE (decl) == TYPE_DECL) { error_at (DECL_SOURCE_LOCATION (decl), - "typedef %qD is initialized (use decltype instead)", decl); + "typedef %qD is initialized (use %qs instead)", + decl, "decltype"); return error_mark_node; } @@ -7020,8 +7021,8 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p, return; if (TREE_CODE (type) == FUNCTION_TYPE) { - error ("initializer for % has function type " - "(did you forget the %<()%> ?)", decl); + error ("initializer for % has function type; " + "did you forget the %<()%>?", decl); TREE_TYPE (decl) = error_mark_node; return; } @@ -13614,7 +13615,7 @@ grok_op_properties (tree decl, bool complain) if (operator_code == COND_EXPR) { /* 13.4.0.3 */ - error_at (loc, "ISO C++ prohibits overloading operator ?:"); + error_at (loc, "ISO C++ prohibits overloading %"); return false; } diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index fb3b911fdd5..bd022ca7ae3 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -830,7 +830,8 @@ grokfield (const cp_declarator *declarator, if (TREE_CODE (value) == TYPE_DECL && init) { error_at (cp_expr_loc_or_loc (init, DECL_SOURCE_LOCATION (value)), - "typedef %qD is initialized (use decltype instead)", value); + "typedef %qD is initialized (use %qs instead)", + value, "decltype"); init = NULL_TREE; } @@ -1772,12 +1773,13 @@ coerce_delete_type (tree decl, location_t loc) else /* A destroying operator delete shall be a class member function named operator delete. */ - error_at (loc, "destroying operator delete must be a member function"); + error_at (loc, + "destroying % must be a member function"); const ovl_op_info_t *op = IDENTIFIER_OVL_OP_INFO (DECL_NAME (decl)); if (op->flags & OVL_OP_FLAG_VEC) - error_at (loc, "operator delete[] cannot be a destroying delete"); + error_at (loc, "% cannot be a destroying delete"); if (!usual_deallocation_fn_p (decl)) - error_at (loc, "destroying operator delete must be a usual " + error_at (loc, "destroying % must be a usual " "deallocation function"); } diff --git a/gcc/cp/except.c b/gcc/cp/except.c index 3b792cbc62b..892d5201da9 100644 --- a/gcc/cp/except.c +++ b/gcc/cp/except.c @@ -936,7 +936,7 @@ is_admissible_throw_operand_or_catch_parameter (tree t, bool is_throw) && TYPE_REF_P (type) && TYPE_REF_IS_RVALUE (type)) { - error ("cannot declare catch parameter to be of rvalue " + error ("cannot declare % parameter to be of rvalue " "reference type %qT", type); return false; } diff --git a/gcc/cp/friend.c b/gcc/cp/friend.c index 2429cd4c497..4ea4bbc54a5 100644 --- a/gcc/cp/friend.c +++ b/gcc/cp/friend.c @@ -638,9 +638,10 @@ do_friend (tree ctype, tree declarator, tree decl, "%q#D declares a non-template function", decl); if (! explained && warned) { - inform (input_location, "(if this is not what you intended, make sure " - "the function template has already been declared " - "and add <> after the function name here) "); + inform (input_location, "(if this is not what you intended, " + "make sure the function template has already been " + "declared and add %<<>%> after the function name " + "here)"); explained = 1; } } diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 68d04ad7417..e70c89d0d46 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -3005,7 +3005,7 @@ build_new_1 (vec **placement, tree type, tree nelts, pedwarn (cp_expr_loc_or_loc (outer_nelts, input_location), OPT_Wvla, typedef_variant_p (orig_type) ? G_("non-constant array new length must be specified " - "directly, not by typedef") + "directly, not by %") : G_("non-constant array new length must be specified " "without parentheses around the type-id")); } @@ -3016,13 +3016,13 @@ build_new_1 (vec **placement, tree type, tree nelts, if (VOID_TYPE_P (elt_type)) { if (complain & tf_error) - error ("invalid type % for new"); + error ("invalid type % for %"); return error_mark_node; } if (is_std_init_list (elt_type)) warning (OPT_Winit_list_lifetime, - "% of initializer_list does not " + "% of % does not " "extend the lifetime of the underlying array"); if (abstract_virtuals_error_sfinae (ACU_NEW, elt_type, complain)) @@ -3867,11 +3867,11 @@ build_vec_delete_1 (tree base, tree maxindex, tree type, auto_diagnostic_group d; if (warning (OPT_Wdelete_incomplete, "possible problem detected in invocation of " - "delete [] operator:")) + "operator %")) { cxx_incomplete_type_diagnostic (base, type, DK_WARNING); inform (input_location, "neither the destructor nor the " - "class-specific operator delete [] will be called, " + "class-specific operator % will be called, " "even if they are declared when the class is defined"); } } @@ -4753,14 +4753,14 @@ build_delete (tree otype, tree addr, special_function_kind auto_delete, { auto_diagnostic_group d; if (warning (OPT_Wdelete_incomplete, - "possible problem detected in invocation of " - "delete operator:")) + "possible problem detected in invocation of " + "%")) { cxx_incomplete_type_diagnostic (addr, type, DK_WARNING); inform (input_location, - "neither the destructor nor the class-specific " - "operator delete will be called, even if they " - "are declared when the class is defined"); + "neither the destructor nor the class-specific " + "% will be called, even if " + "they are declared when the class is defined"); } } } diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index 369ecc05df2..20965e49fe4 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -385,14 +385,14 @@ parse_strconst_pragma (const char* name, int opt) if (t == CPP_STRING) { if (pragma_lex (&x) != CPP_EOF) - warning (0, "junk at end of #pragma %s", name); + warning (0, "junk at end of %<#pragma %s%>", name); return result; } if (t == CPP_EOF && opt) return NULL_TREE; - error ("invalid #pragma %s", name); + error ("invalid %<#pragma %s%>", name); return error_mark_node; } @@ -400,7 +400,7 @@ static void handle_pragma_vtable (cpp_reader* /*dfile*/) { parse_strconst_pragma ("vtable", 0); - sorry ("#pragma vtable no longer supported"); + sorry ("%<#pragma vtable%> no longer supported"); } static void @@ -472,7 +472,7 @@ handle_pragma_implementation (cpp_reader* /*dfile*/) { filename = TREE_STRING_POINTER (fname); if (cpp_included_before (parse_in, filename, input_location)) - warning (0, "#pragma implementation for %qs appears after " + warning (0, "%<#pragma implementation%> for %qs appears after " "file is included", filename); } @@ -568,8 +568,8 @@ unqualified_fn_lookup_error (cp_expr name_expr) if (!hint) { inform (loc, "(if you use %<-fpermissive%>, G++ will accept your " - "code, but allowing the use of an undeclared name is " - "deprecated)"); + "code, but allowing the use of an undeclared name is " + "deprecated)"); hint = true; } } diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index c13dacbd05e..4638f347feb 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -2305,11 +2305,11 @@ write_type (tree type) break; case TYPEOF_TYPE: - sorry ("mangling typeof, use decltype instead"); + sorry ("mangling %, use % instead"); break; case UNDERLYING_TYPE: - sorry ("mangling __underlying_type"); + sorry ("mangling %<__underlying_type%>"); break; case LANG_TYPE: diff --git a/gcc/cp/method.c b/gcc/cp/method.c index 31737d1353c..1cb93fd0dc4 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -2249,7 +2249,7 @@ defaulted_late_check (tree fn) { error ("explicitly defaulted function %q+D cannot be declared " "as % because the implicit declaration is not " - "%:", fn); + "%qs:", fn, "constexpr"); explain_implicit_non_constexpr (fn); } DECL_DECLARED_CONSTEXPR_P (fn) = false; diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index 89d85f6c7d7..d8d71be98ec 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -3270,10 +3270,10 @@ cp_binding_level_debug (cp_binding_level *scope, int line, const char *action) { const char *desc = cp_binding_level_descriptor (scope); if (scope->this_entity) - verbatim ("%s %<%s(%E)%> %p %d\n", action, desc, + verbatim ("%s %<%s(%E)%> %p %d", action, desc, scope->this_entity, (void *) scope, line); else - verbatim ("%s %s %p %d\n", action, desc, (void *) scope, line); + verbatim ("%s %s %p %d", action, desc, (void *) scope, line); } /* A chain of binding_level structures awaiting reuse. */ @@ -7499,7 +7499,7 @@ void pop_everything (void) { if (ENABLE_SCOPE_CHECKING) - verbatim ("XXX entering pop_everything ()\n"); + verbatim ("XXX entering %"); while (!namespace_bindings_p ()) { if (current_binding_level->kind == sk_class) @@ -7508,7 +7508,7 @@ pop_everything (void) poplevel (0, 0, 0); } if (ENABLE_SCOPE_CHECKING) - verbatim ("XXX leaving pop_everything ()\n"); + verbatim ("XXX leaving %"); } /* Emit debugging information for using declarations and directives. diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index c90782eafde..89160b9f882 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -1308,7 +1308,7 @@ cp_lexer_start_debugging (cp_lexer* lexer) { if (!LEXER_DEBUGGING_ENABLED_P) fatal_error (input_location, - "LEXER_DEBUGGING_ENABLED_P is not set to true"); + "% is not set to true"); lexer->debugging_p = true; cp_lexer_debug_stream = stderr; @@ -1321,7 +1321,7 @@ cp_lexer_stop_debugging (cp_lexer* lexer) { if (!LEXER_DEBUGGING_ENABLED_P) fatal_error (input_location, - "LEXER_DEBUGGING_ENABLED_P is not set to true"); + "% is not set to true"); lexer->debugging_p = false; cp_lexer_debug_stream = NULL; @@ -4537,7 +4537,7 @@ cp_parser_userdef_numeric_literal (cp_parser *parser) else if (i14) { inform (token->location, "add % " - "(from ) to enable the C++14 user-defined literal " + "(from %<%>) to enable the C++14 user-defined literal " "suffixes"); if (ext) inform (token->location, "or use % instead of % for the " @@ -6400,7 +6400,7 @@ cp_parser_nested_name_specifier_opt (cp_parser *parser, == CPP_SCOPE)) { token = cp_lexer_consume_token (parser->lexer); - error_at (token->location, "decltype evaluates to %qT, " + error_at (token->location, "% evaluates to %qT, " "which is not a class or enumeration type", token->u.tree_check_value->value); parser->scope = error_mark_node; @@ -9671,7 +9671,7 @@ cp_parser_question_colon_clause (cp_parser* parser, cp_expr logical_or_expr) && token->type == CPP_COLON) { pedwarn (token->location, OPT_Wpedantic, - "ISO C++ does not allow ?: with omitted middle operand"); + "ISO C++ does not allow % with omitted middle operand"); /* Implicit true clause. */ expr = NULL_TREE; c_inhibit_evaluation_warnings += @@ -14442,7 +14442,7 @@ cp_parser_static_assert(cp_parser *parser, bool member_p) { if (cxx_dialect < cxx17) pedwarn (input_location, OPT_Wpedantic, - "static_assert without a message " + "% without a message " "only available with %<-std=c++17%> or %<-std=gnu++17%>"); /* Eat the ')' */ cp_lexer_consume_token (parser->lexer); @@ -19821,14 +19821,15 @@ cp_parser_asm_definition (cp_parser* parser) case RID_VOLATILE: if (volatile_loc) { - error_at (loc, "duplicate asm qualifier %qT", token->u.value); + error_at (loc, "duplicate % qualifier %qT", + token->u.value); inform (volatile_loc, "first seen here"); } else { if (!parser->in_function_body) - warning_at (loc, 0, "asm qualifier %qT ignored outside of " - "function body", token->u.value); + warning_at (loc, 0, "% qualifier %qT ignored " + "outside of function body", token->u.value); volatile_loc = loc; } cp_lexer_consume_token (parser->lexer); @@ -19837,7 +19838,8 @@ cp_parser_asm_definition (cp_parser* parser) case RID_INLINE: if (inline_loc) { - error_at (loc, "duplicate asm qualifier %qT", token->u.value); + error_at (loc, "duplicate % qualifier %qT", + token->u.value); inform (inline_loc, "first seen here"); } else @@ -19850,7 +19852,8 @@ cp_parser_asm_definition (cp_parser* parser) case RID_GOTO: if (goto_loc) { - error_at (loc, "duplicate asm qualifier %qT", token->u.value); + error_at (loc, "duplicate % qualifier %qT", + token->u.value); inform (goto_loc, "first seen here"); } else @@ -19862,7 +19865,7 @@ cp_parser_asm_definition (cp_parser* parser) case RID_CONST: case RID_RESTRICT: - error_at (loc, "%qT is not an asm qualifier", token->u.value); + error_at (loc, "%qT is not an % qualifier", token->u.value); cp_lexer_consume_token (parser->lexer); continue; @@ -19878,7 +19881,7 @@ cp_parser_asm_definition (cp_parser* parser) if (!parser->in_function_body && (inline_p || goto_p)) { - error_at (first_loc, "asm qualifier outside of function body"); + error_at (first_loc, "% qualifier outside of function body"); inline_p = goto_p = false; } @@ -20260,7 +20263,7 @@ cp_parser_init_declarator (cp_parser* parser, on a function-definition. */ if (asm_specification) error_at (asm_spec_start_token->location, - "an asm-specification is not allowed " + "an %-specification is not allowed " "on a function-definition"); if (attributes) error_at (attributes_start_token->location, @@ -27916,12 +27919,12 @@ cp_parser_template_declaration_after_parameters (cp_parser* parser, { if (cxx_dialect > cxx17) error ("literal operator template %qD has invalid parameter list;" - " Expected non-type template parameter pack " + " expected non-type template parameter pack %<%> " "or single non-type parameter of class type", decl); else - error ("literal operator template %qD has invalid parameter list." - " Expected non-type template parameter pack ", + error ("literal operator template %qD has invalid parameter list;" + " expected non-type template parameter pack %<%>", decl); } } @@ -39637,8 +39640,8 @@ cp_parser_omp_declare_reduction (cp_parser *parser, cp_token *pragma_tok, error_at (loc, "reference type %qT in " "%<#pragma omp declare reduction%>", type); else if (TYPE_QUALS_NO_ADDR_SPACE (type)) - error_at (loc, "const, volatile or __restrict qualified type %qT in " - "%<#pragma omp declare reduction%>", type); + error_at (loc, "%, % or %<__restrict%>-qualified " + "type %qT in %<#pragma omp declare reduction%>", type); else types.safe_push (type); @@ -40489,7 +40492,7 @@ cp_parser_transaction (cp_parser *parser, cp_token *token) else if (keyword == RID_ATOMIC_CANCEL) { /* cancel-and-throw is unimplemented. */ - sorry ("atomic_cancel"); + sorry ("%"); noex = NULL_TREE; } else diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 42d128744ab..b90230f1927 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -1058,10 +1058,11 @@ maybe_process_partial_specialization (tree type) if (current_namespace != decl_namespace_context (tmpl)) { - permerror (input_location, - "specializing %q#T in different namespace", type); - permerror (DECL_SOURCE_LOCATION (tmpl), - " from definition of %q#D", tmpl); + if (permerror (input_location, + "specialization of %qD in different namespace", + type)) + inform (DECL_SOURCE_LOCATION (tmpl), + "from definition of %q#D", tmpl); } /* Check for invalid specialization after instantiation: @@ -3606,7 +3607,8 @@ expand_integer_pack (tree call, tree args, tsubst_flags_t complain, { if ((complain & tf_error) && hi != error_mark_node) - error ("argument to __integer_pack must be between 0 and %d", max); + error ("argument to %<__integer_pack%> must be between 0 and %d", + max); return error_mark_node; } diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index 26dae3c3c1a..a1fd8d958e3 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -512,7 +512,7 @@ get_typeid (tree type, tsubst_flags_t complain) || type_memfn_rqual (type) != REF_QUAL_NONE)) { if (complain & tf_error) - error ("typeid of qualified function type %qT", type); + error ("% of qualified function type %qT", type); return error_mark_node; } @@ -693,8 +693,8 @@ build_dynamic_cast_1 (tree type, tree expr, tsubst_flags_t complain) { tree expr = throw_bad_cast (); if (complain & tf_warning) - warning (0, "dynamic_cast of %q#D to %q#T can never succeed", - old_expr, type); + warning (0, "%(%#D)%> can never succeed", + type, old_expr); /* Bash it to the expected type. */ TREE_TYPE (expr) = type; return expr; @@ -708,8 +708,8 @@ build_dynamic_cast_1 (tree type, tree expr, tsubst_flags_t complain) && TREE_CODE (TREE_TYPE (op)) == RECORD_TYPE) { if (complain & tf_warning) - warning (0, "dynamic_cast of %q#D to %q#T can never succeed", - op, type); + warning (0, "%(%#D)%> can never succeed", + type, op); retval = build_int_cst (type, 0); return retval; } @@ -798,7 +798,7 @@ build_dynamic_cast_1 (tree type, tree expr, tsubst_flags_t complain) fail: if (complain & tf_error) - error ("cannot dynamic_cast %qE (of type %q#T) to type %q#T (%s)", + error ("cannot % %qE (of type %q#T) to type %q#T (%s)", old_expr, TREE_TYPE (old_expr), type, errstr); return error_mark_node; } diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 38459342384..fc5edde89c3 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -1585,7 +1585,7 @@ finish_asm_stmt (int volatile_p, tree string, tree output_operands, resolve the overloading. */ if (TREE_TYPE (operand) == unknown_type_node) { - error ("type of asm operand %qE could not be determined", + error ("type of % operand %qE could not be determined", TREE_VALUE (t)); operand = error_mark_node; } @@ -1667,7 +1667,7 @@ finish_label_decl (tree name) { if (!at_function_scope_p ()) { - error ("__label__ declarations are only allowed in function scopes"); + error ("%<__label__%> declarations are only allowed in function scopes"); return; } @@ -4099,7 +4099,7 @@ finish_bases (tree type, bool direct) if (!processing_template_decl) { /* Parameter packs can only be used in templates */ - error ("Parameter pack __bases only valid in template declaration"); + error ("parameter pack %<__bases%> only valid in template declaration"); return error_mark_node; } @@ -4164,7 +4164,7 @@ finish_offsetof (tree object_ptr, tree expr, location_t loc) && CLASS_TYPE_P (TREE_TYPE (TREE_TYPE (object_ptr))) && CLASSTYPE_NON_STD_LAYOUT (TREE_TYPE (TREE_TYPE (object_ptr))) && cp_unevaluated_operand == 0) - warning_at (loc, OPT_Winvalid_offsetof, "offsetof within " + warning_at (loc, OPT_Winvalid_offsetof, "% within " "non-standard-layout type %qT is conditionally-supported", TREE_TYPE (TREE_TYPE (object_ptr))); return fold_offsetof (expr); @@ -5546,8 +5546,8 @@ cp_check_omp_declare_reduction (tree udr) } else if (TYPE_QUALS_NO_ADDR_SPACE (type)) { - error_at (loc, "const, volatile or __restrict qualified type %qT in " - "%<#pragma omp declare reduction%>", type); + error_at (loc, "%, % or %<__restrict%>-qualified " + "type %qT in %<#pragma omp declare reduction%>", type); return; } @@ -9334,7 +9334,7 @@ finish_decltype_type (tree expr, bool id_expression_or_member_access_p, && TYPE_P (TREE_OPERAND (expr, 0)))) { if (complain & tf_error) - error ("argument to decltype must be an expression"); + error ("argument to % must be an expression"); return error_mark_node; } @@ -9362,7 +9362,7 @@ finish_decltype_type (tree expr, bool id_expression_or_member_access_p, if (type_unknown_p (expr)) { if (complain & tf_error) - error ("decltype cannot resolve address of overloaded function"); + error ("% cannot resolve address of overloaded function"); return error_mark_node; } diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 7b8889ea7b2..e61f583b174 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -4474,7 +4474,7 @@ handle_init_priority_attribute (tree* node, if (!initp_expr || TREE_CODE (initp_expr) != INTEGER_CST) { - error ("requested init_priority is not an integer constant"); + error ("requested % is not an integer constant"); cxx_constant_value (initp_expr); *no_add_attrs = true; return NULL_TREE; @@ -4504,7 +4504,8 @@ handle_init_priority_attribute (tree* node, if (pri > MAX_INIT_PRIORITY || pri <= 0) { - error ("requested init_priority is out of range"); + error ("requested % %i is out of range [0, %i]", + pri, MAX_INIT_PRIORITY); *no_add_attrs = true; return NULL_TREE; } @@ -4514,7 +4515,8 @@ handle_init_priority_attribute (tree* node, if (pri <= MAX_RESERVED_INIT_PRIORITY) { warning - (0, "requested init_priority is reserved for internal use"); + (0, "requested % %i is reserved for internal use", + pri); } if (SUPPORTS_INIT_PRIORITY) @@ -5479,7 +5481,7 @@ maybe_warn_zero_as_null_pointer_constant (tree expr, location_t loc) void lang_check_failed (const char* file, int line, const char* function) { - internal_error ("lang_* check: failed in %s, at %s:%d", + internal_error ("% check: failed in %s, at %s:%d", function, trim_filename (file), line); } #endif /* ENABLE_TREE_CHECKING */ diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 36e6b2474f0..7289f2c49fc 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -4887,7 +4887,7 @@ cp_build_binary_op (const op_location_t &location, && c_inhibit_evaluation_warnings == 0 && (FLOAT_TYPE_P (type0) || FLOAT_TYPE_P (type1))) warning (OPT_Wfloat_equal, - "comparing floating point with == or != is unsafe"); + "comparing floating point with %<==%> or % is unsafe"); if (complain & tf_warning) { tree stripped_orig_op0 = tree_strip_any_location_wrapper (orig_op0); @@ -6274,7 +6274,7 @@ cp_build_unary_op (enum tree_code code, tree xarg, bool noconvert, if (TREE_CODE (TREE_TYPE (arg)) == BOOLEAN_TYPE && (complain & tf_warning) && warning_at (location, OPT_Wbool_operation, - "%<~%> on an expression of type bool")) + "%<~%> on an expression of type %")) inform (location, "did you mean to use logical not (%)?"); arg = cp_perform_integral_promotions (arg, complain); } @@ -6942,13 +6942,15 @@ check_for_casting_away_constness (tree src_type, tree dest_type, case STATIC_CAST_EXPR: if (complain & tf_error) - error ("static_cast from type %qT to type %qT casts away qualifiers", + error ("% from type %qT to type %qT casts away " + "qualifiers", src_type, dest_type); return true; case REINTERPRET_CAST_EXPR: if (complain & tf_error) - error ("reinterpret_cast from type %qT to type %qT casts away qualifiers", + error ("% from type %qT to type %qT casts away " + "qualifiers", src_type, dest_type); return true; @@ -7401,7 +7403,7 @@ build_static_cast (tree type, tree oexpr, tsubst_flags_t complain) if (complain & tf_error) { - error ("invalid static_cast from type %qT to type %qT", + error ("invalid % from type %qT to type %qT", TREE_TYPE (expr), type); if ((TYPE_PTR_P (type) || TYPE_REF_P (type)) && CLASS_TYPE_P (TREE_TYPE (type)) @@ -7738,7 +7740,7 @@ build_const_cast_1 (tree dst_type, tree expr, tsubst_flags_t complain, if (!INDIRECT_TYPE_P (dst_type) && !TYPE_PTRDATAMEM_P (dst_type)) { if (complain & tf_error) - error ("invalid use of const_cast with type %qT, " + error ("invalid use of % with type %qT, " "which is not a pointer, " "reference, nor a pointer-to-data-member type", dst_type); return error_mark_node; @@ -7747,8 +7749,9 @@ build_const_cast_1 (tree dst_type, tree expr, tsubst_flags_t complain, if (TREE_CODE (TREE_TYPE (dst_type)) == FUNCTION_TYPE) { if (complain & tf_error) - error ("invalid use of const_cast with type %qT, which is a pointer " - "or reference to a function type", dst_type); + error ("invalid use of % with type %qT, " + "which is a pointer or reference to a function type", + dst_type); return error_mark_node; } @@ -7788,7 +7791,8 @@ build_const_cast_1 (tree dst_type, tree expr, tsubst_flags_t complain, else { if (complain & tf_error) - error ("invalid const_cast of an rvalue of type %qT to type %qT", + error ("invalid % of an rvalue of type %qT " + "to type %qT", src_type, dst_type); return error_mark_node; } @@ -7857,7 +7861,7 @@ build_const_cast_1 (tree dst_type, tree expr, tsubst_flags_t complain, } if (complain & tf_error) - error ("invalid const_cast from type %qT to type %qT", + error ("invalid % from type %qT to type %qT", src_type, dst_type); return error_mark_node; } @@ -9260,7 +9264,7 @@ maybe_warn_about_returning_address_of_local (tree retval) "returning reference to temporary"); else if (is_std_init_list (valtype)) warning_at (loc, OPT_Winit_list_lifetime, - "returning temporary initializer_list does not extend " + "returning temporary % does not extend " "the lifetime of the underlying array"); return true; } @@ -9298,7 +9302,7 @@ maybe_warn_about_returning_address_of_local (tree retval) whats_returned); else if (is_std_init_list (valtype)) w = warning_at (loc, OPT_Winit_list_lifetime, - "returning local initializer_list variable %qD " + "returning local % variable %qD " "does not extend the lifetime of the underlying array", whats_returned); else if (TREE_CODE (whats_returned) == LABEL_DECL) @@ -9654,7 +9658,7 @@ check_return_expr (tree retval, bool *no_warning) && ! flag_check_new && retval && null_ptr_cst_p (retval)) warning (0, "% must not return NULL unless it is " - "declared % (or -fcheck-new is in effect)"); + "declared % (or %<-fcheck-new%> is in effect)"); /* Effective C++ rule 15. See also start_function. */ if (warn_ecpp diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index 618eed9a96d..e9f759d4213 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -360,7 +360,7 @@ abstract_virtuals_error_sfinae (tree decl, tree type, abstract_class_use use, "be used in throw-expression", type); break; case ACU_CATCH: - error ("cannot declare catch parameter to be of abstract " + error ("cannot declare % parameter to be of abstract " "class type %qT", type); break; default: @@ -380,7 +380,7 @@ abstract_virtuals_error_sfinae (tree decl, tree type, abstract_class_use use, FOR_EACH_VEC_ELT (*pure, ix, fn) if (! DECL_CLONED_FUNCTION_P (fn) || DECL_COMPLETE_DESTRUCTOR_P (fn)) - inform (DECL_SOURCE_LOCATION (fn), "\t%#qD", fn); + inform (DECL_SOURCE_LOCATION (fn), " %#qD", fn); /* Now truncate the vector. This leaves it non-null, so we know there are pure virtuals, but empty so we don't list them out @@ -1164,8 +1164,8 @@ digest_init_r (tree type, tree init, int nested, int flags, be invalid. */ if (size < TREE_STRING_LENGTH (stripped_init)) { - permerror (loc, "initializer-string for array " - "of chars is too long"); + permerror (loc, "initializer-string for %qT is too long", + type); init = build_string (size, TREE_STRING_POINTER (stripped_init)); @@ -2215,7 +2215,7 @@ build_functional_cast (tree exp, tree parms, tsubst_flags_t complain) if (type == error_mark_node) { if (complain & tf_error) - error ("cannot deduce template arguments for %qT from ()", + error ("cannot deduce template arguments for %qT from %<()%>", anode); return error_mark_node; } From patchwork Tue May 14 21:32:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Sebor X-Patchwork-Id: 1099740 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-500692-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="CU3FZjLL"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="JIW1+v02"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 453WC23LdHz9sDn for ; Wed, 15 May 2019 07:33:34 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=KiMo8++YuDIBMr1a/lcu/62lNCzf0K3KGUINnMkX6GicYL+fnM le+wbi7BXUeZOkSofDUftmDbno7zKe1vFdNeylx3/nV0HrobcgbYqlz9d7qtQ4vR AqkiedlxRcEq+sFVPRJK40HpCupE5IYdwBK+yPOObwsRyhxaUfiXfFUzA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=uPKTjoz7wAAB1GKPPQk82QMru1Q=; b=CU3FZjLL+s8lwpB/CUqd uXj8iwdLIGRUW4Bv1pm4DoycTyuiScDKUuFxcAAbI5r37+d3xJAF/vgB82wG1ZNN R6HkJQ6MJGCBHNrBXtn8wHMFwpwHAS+857Jlhi7Aj/AiC3kbL5yCNOQy5OU4GBCm sY2LdJkqRWn32brh9+9KEqM= Received: (qmail 40363 invoked by alias); 14 May 2019 21:32:41 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 40277 invoked by uid 89); 14 May 2019 21:32:40 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-20.7 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=unread X-HELO: mail-qt1-f178.google.com Received: from mail-qt1-f178.google.com (HELO mail-qt1-f178.google.com) (209.85.160.178) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 14 May 2019 21:32:38 +0000 Received: by mail-qt1-f178.google.com with SMTP id a39so899947qtk.2 for ; Tue, 14 May 2019 14:32:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:date:user-agent:mime-version :content-language; bh=KTYC74Uaj7kKe0827AjVsBRgS/D2pkZfwD40OnrFKtk=; b=JIW1+v02kg8y+oww125ZXdtS7Bbv9QJxIVS+ko3pxfJl2URyFNSfj/CGETsvETj4qO TUsOqKxaVupynAWHkHRftpj9I9UQo8ioLJzer/a6eyJ6UBWvq0jZjheAeuYCLFdGLUeI GCF0PisrZdIY8O23xm4Y4APEzEi5O7O/951lUneyhbgunuAqjj4FApTA2vianWn7GFn7 lGPrSStP0nj1FkTKDqtLRSTgNU4bw1ib30ccAPJ9AWcQ2M4c62kDEA+QuZ+WVC/mc+w5 eAy+QmyxgtMDL6dm5mliP+vO5FUFbdsA4oyezJsxPoygw7tFKgT7a2RLyXpKmVHhnF4O Mc5w== Received: from [192.168.0.41] (97-118-125-210.hlrn.qwest.net. [97.118.125.210]) by smtp.gmail.com with ESMTPSA id d16sm103137qtd.73.2019.05.14.14.32.35 for (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Tue, 14 May 2019 14:32:35 -0700 (PDT) To: gcc-patches From: Martin Sebor Subject: [PATCH 7/12] fix diagnostic quoting/spelling in libgcc Message-ID: Date: Tue, 14 May 2019 15:32:34 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 MIME-Version: 1.0 X-IsSubscribed: yes The attached patch fixes quoting, spelling, and other formatting issues in diagnostics issued from files in the libgcc directory and pointed out by the -Wformat-diag warning. Martin libgcc/ChangeLog: * libgcov-util.c (read_gcda_file): Remove trailing newline. diff --git a/libgcc/libgcov-util.c b/libgcc/libgcov-util.c index ae0dd017204..62f4fe38233 100644 --- a/libgcc/libgcov-util.c +++ b/libgcc/libgcov-util.c @@ -332,7 +332,7 @@ read_gcda_file (const char *filename) { if (((mask & 0xff) != 0xff)) { - warning (0, "%s:tag `%x' is invalid\n", filename, tag); + warning (0, "%s:tag %qx is invalid", filename, tag); break; } tag_depth--; @@ -347,7 +347,7 @@ read_gcda_file (const char *filename) if (depth && depth < tag_depth) { if (!GCOV_TAG_IS_SUBTAG (tags[depth - 1], tag)) - warning (0, "%s:tag `%x' is incorrectly nested\n", + warning (0, "%s:tag %qx is incorrectly nested", filename, tag); } depth = tag_depth; @@ -362,18 +362,18 @@ read_gcda_file (const char *filename) actual_length = gcov_position () - base; if (actual_length > length) - warning (0, "%s:record size mismatch %lu bytes overread\n", + warning (0, "%s:record size mismatch %lu bytes overread", filename, actual_length - length); else if (length > actual_length) - warning (0, "%s:record size mismatch %lu bytes unread\n", + warning (0, "%s:record size mismatch %lu bytes unread", filename, length - actual_length); } gcov_sync (base, length); if ((error = gcov_is_error ())) { - warning (0, error < 0 ? "%s:counter overflow at %lu\n" : - "%s:read error at %lu\n", filename, + warning (0, error < 0 ? "%s:counter overflow at %lu" : + "%s:read error at %lu", filename, (long unsigned) gcov_position ()); break; } From patchwork Tue May 14 21:32:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Sebor X-Patchwork-Id: 1099747 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-500695-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="wywD3UIQ"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="nIx61NyB"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 453WDC44mxz9sNd for ; Wed, 15 May 2019 07:34:31 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=tuLWQSBXMX+d0q1FKxySRtXpAOqANHQeF0ruWOa9yh3pj+EkWY 24eWaHhheptP39eKi4O/mJ3kHM54nk5u1lYZQiP1p1xtfxC65F86oj6JEO2eKjDy NoGkgq/C3R3nrPYGvRVq7gRZnVIc7M4PtCQvYGVq6z0goTxfdLlMWopXw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=ludN2vSlAGXrLBoRoP67Z4OSCCo=; b=wywD3UIQdgSYEnaefn1Y nyKb7Byz3VMgZrz0oTeLqDivH9UCxdnrKXbtdJcHkw4GrSgx+WLyEV/82welvF9A tRWUJKx+VoTweQkLnFmsYyffjLstGO253WeUSGwi2ufYcNqg7NsniD0I//CiFaYY ZiKHpQgqv7qh01YLXkHYtw0= Received: (qmail 43312 invoked by alias); 14 May 2019 21:33:10 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 43207 invoked by uid 89); 14 May 2019 21:33:09 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.1 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=licensed, uns, Draw, forwarder X-HELO: mail-qk1-f172.google.com Received: from mail-qk1-f172.google.com (HELO mail-qk1-f172.google.com) (209.85.222.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 14 May 2019 21:32:51 +0000 Received: by mail-qk1-f172.google.com with SMTP id c14so225776qke.3 for ; Tue, 14 May 2019 14:32:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:date:user-agent:mime-version :content-language; bh=P/xSkwpEyV6xFQu5jkbYOFZKxYgUEGEsbAbObsm3cm8=; b=nIx61NyBi/43oUh7xc3Ok8ncV0xW2SOcJ+k2YzatWohKU2//zFb/2+RaKlt+WPY/f4 rpxVta0/8da29mZRZiLG34foK+Vy4a00XkR76/DxRQSELaqeRIPmfghC4V9DjQJgRhzT AeYvpXNrbKPb9jN8itXwuMNoRJJwcytY4e3IlAzRIYrzzuQcy0atxi23abjcv/WENKRQ kjPHiVLSKr+ifb7cHyzjdXppCnlBWErBG7Vq6a0V9Wr6GdjfPH6dYxY7mAnDdAO0/3Zk igLnd4kAiKRr6ANikvHezfNKtMQP8zHIFwjNKZ38tu4yUmQY4M0KfzLMS1MtqDxBVPeW 1/sw== Received: from [192.168.0.41] (97-118-125-210.hlrn.qwest.net. [97.118.125.210]) by smtp.gmail.com with ESMTPSA id c18sm8988539qkl.78.2019.05.14.14.32.47 for (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Tue, 14 May 2019 14:32:48 -0700 (PDT) To: gcc-patches From: Martin Sebor Subject: [PATCH 8/12] fix diagnostic quoting/spelling in the middle-end Message-ID: <7033b435-580c-9b63-ae72-59270c930edc@gmail.com> Date: Tue, 14 May 2019 15:32:46 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 MIME-Version: 1.0 X-IsSubscribed: yes The attached patch fixes quoting, spelling, and other formatting issues in diagnostics issued from files in middle-end files and pointed out by the -Wformat-diag warning. Martin gcc/ChangeLog: * builtins.c (expand_builtin_atomic_always_lock_free): Quote identifiers, keywords, operators, and types in diagnostics. Correct quoting, spelling, and sentence capitalization issues. (expand_builtin_atomic_is_lock_free): Same. (fold_builtin_next_arg): Same. * cfgexpand.c (expand_one_var): Same. (tree_conflicts_with_clobbers_p): Same. (expand_asm_stmt): Same. (verify_loop_structure): Same. * cgraphunit.c (process_function_and_variable_attributes): Same. * collect-utils.c (collect_execute): Same. * collect2.c (maybe_run_lto_and_relink): Same. (is_lto_object_file): Same. (scan_prog_file): Same. * convert.c (convert_to_real_1): Same. * diagnostic-core.h (GCC_DIAG_STYLE): Adjust. (GCC_DIAG_RAW_STYLE): New macro. * dwarf2out.c (dwarf2out_begin_prologue): Same. * except.c (verify_eh_tree): Same. * gcc.c (execute): Same. (eval_spec_function): Same. (run_attempt): Same. (driver::set_up_specs): Same. (compare_debug_auxbase_opt_spec_function): Same. * gcov-tool.c (unlink_gcda_file): Same. (do_merge): Same. (do_rewrite): Same. * gcse.c (gcse_or_cprop_is_too_expensive): Same. * gimplify.c (gimplify_asm_expr): Same. (gimplify_adjust_omp_clauses): Same. * hsa-gen.c (gen_hsa_addr_insns): Same. (gen_hsa_insns_for_load): Same. (gen_hsa_cmp_insn_from_gimple): Same. (gen_hsa_insns_for_operation_assignment): Same. (gen_get_level): Same. (gen_hsa_alloca): Same. (omp_simple_builtin::generate): Same. (gen_hsa_atomic_for_builtin): Same. (gen_hsa_insns_for_call): Same. * input.c (dump_location_info): Same. * ipa-devirt.c (compare_virtual_tables): Same. * ira.c (ira_setup_eliminable_regset): Same. * lra-assigns.c (lra_assign): Same. * lra-constraints.c (lra_constraints): Same. * lto-streamer-in.c (lto_input_mode_table): Same. * lto-wrapper.c (get_options_from_collect_gcc_options): Same. (merge_and_complain): Same. (compile_offload_image): Same. (compile_images_for_offload_targets): Same. (debug_objcopy): Same. (run_gcc): Same. (main): Same. * opts.c (print_specific_help): Same. (parse_no_sanitize_attribute): Same. (print_help): Same. (handle_param): Same. * passes.c (opt_pass::clone): Same. * plugin.c (add_new_plugin): Same. (parse_plugin_arg_opt): Same. (try_init_one_plugin): Same. * pretty-print.h (GCC_DIAG_RAW_STYLE): Adjust. (GCC_DIAG_RAW_STYLE): New macro. * print-rtl.c (debug_bb_n_slim): Quote identifiers, keywords, operators, and types in diagnostics. Correct quoting and spelling issues. * read-rtl-function.c (parse_edge_flag_token): Same. (function_reader::parse_enum_value): Same. * reg-stack.c (check_asm_stack_operands): Same. * regcprop.c (validate_value_data): Same. * sched-rgn.c (make_pass_sched_fusion): Same. * stmt.c (check_unique_operand_names): Same. * targhooks.c (default_target_option_pragma_parse): Same. * tlink.c (recompile_files): Same. * toplev.c (process_options): Same. (do_compile): Same. * trans-mem.c (diagnose_tm_1): Same. (ipa_tm_scan_irr_block): Same. (ipa_tm_diagnose_transaction): Same. * tree-cfg.c (verify_address): Same. Use get_tree_code_name to format a tree code name in a diagnostic. (verify_types_in_gimple_min_lval): Same. (verify_types_in_gimple_reference): Same. (verify_gimple_call): Same. (verify_gimple_assign_unary): Same. (verify_gimple_assign_binary): Same. (verify_gimple_assign_ternary): Same. (verify_gimple_assign_single): Same. (verify_gimple_switch): Same. (verify_gimple_label): Same. (verify_gimple_phi): Same. (verify_gimple_in_seq): Same. (verify_eh_throw_stmt_node): Same. (collect_subblocks): Same. (gimple_verify_flow_info): Same. (do_warn_unused_result): Same. * tree-inline.c (expand_call_inline): Same. * tree-into-ssa.c (update_ssa): Same. * tree.c (tree_int_cst_elt_check_failed): Same. (tree_vec_elt_check_failed): Same. (omp_clause_operand_check_failed): Same. (verify_type_variant): Same. (verify_type): Same. * value-prof.c (verify_histograms): Same. * varasm.c (assemble_start_function): Same. * cfghooks.c: Disable -Wformat-diags. * cfgloop.c: Same. * cfgrtl.c: Same. * cgraph.c: Same. * diagnostic-show-locus.c: Same. * diagnostic.c: Same. * gimple-pretty-print.c: Same. * graph.c: Same. * symtab.c: Same. * tree-eh.c Same. * tree-pretty-print.c: Same. * tree-ssa.c: Same. * configure: Regenerate. * configure.ac (ACX_PROG_CXX_WARNING_OPTS): Add -Wno-error=format-diag. (ACX_PROG_CC_WARNING_OPTS): Same. gcc/lto/ChangeLog: * lto-dump.c (lto_main): Same. * lto.c (stream_out): Same. diff --git a/gcc/builtins.c b/gcc/builtins.c index d37d73fc4a0..0456a9ef646 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -6784,7 +6784,7 @@ expand_builtin_atomic_always_lock_free (tree exp) if (TREE_CODE (arg0) != INTEGER_CST) { - error ("non-constant argument 1 to __atomic_always_lock_free"); + error ("non-constant argument 1 to %qs", "__atomic_always_lock_free"); return const0_rtx; } @@ -6826,7 +6826,7 @@ expand_builtin_atomic_is_lock_free (tree exp) if (!INTEGRAL_TYPE_P (TREE_TYPE (arg0))) { - error ("non-integer argument 1 to __atomic_is_lock_free"); + error ("non-integer argument 1 to %qs", "__atomic_is_lock_free"); return NULL_RTX; } @@ -10224,7 +10224,7 @@ fold_builtin_next_arg (tree exp, bool va_start_p) if (!stdarg_p (fntype)) { - error ("% used in function with fixed args"); + error ("% used in function with fixed arguments"); return true; } diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index 3a4bd354bf9..1c2433286a5 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -1702,7 +1702,7 @@ expand_one_var (tree var, bool toplevel, bool really_expand) { if (lookup_attribute ("naked", DECL_ATTRIBUTES (current_function_decl))) - error ("cannot allocate stack for variable %q+D, naked function.", + error ("cannot allocate stack for variable %q+D, naked function", var); expand_one_stack_var (origvar); @@ -2840,7 +2840,8 @@ tree_conflicts_with_clobbers_p (tree t, HARD_REG_SET *clobbered_regs) if (overlap) { - error ("asm-specifier for variable %qE conflicts with asm clobber list", + error ("%-specifier for variable %qE conflicts with " + "% clobber list", DECL_NAME (overlap)); /* Reset registerness to stop multiple errors emitted for a single @@ -3262,7 +3263,8 @@ expand_asm_stmt (gasm *stmt) if (allows_reg && TYPE_MODE (type) != BLKmode) op = force_reg (TYPE_MODE (type), op); else if (!allows_mem) - warning (0, "asm operand %d probably doesn%'t match constraints", + warning (0, "% operand %d probably does not match " + "constraints", i + noutputs); else if (MEM_P (op)) { @@ -3445,11 +3447,13 @@ expand_asm_stmt (gasm *stmt) tripping over the under-construction body. */ for (unsigned k = 0; k < noutputs; ++k) if (reg_overlap_mentioned_p (clobbered_reg, output_rvec[k])) - internal_error ("asm clobber conflict with output operand"); + internal_error ("% clobber conflict with " + "output operand"); for (unsigned k = 0; k < ninputs - ninout; ++k) if (reg_overlap_mentioned_p (clobbered_reg, input_rvec[k])) - internal_error ("asm clobber conflict with input operand"); + internal_error ("% clobber conflict with " + "input operand"); } XVECEXP (body, 0, i++) = gen_rtx_CLOBBER (VOIDmode, clobbered_reg); diff --git a/gcc/cfghooks.c b/gcc/cfghooks.c index a1d603a207e..a25441b2640 100644 --- a/gcc/cfghooks.c +++ b/gcc/cfghooks.c @@ -32,6 +32,12 @@ along with GCC; see the file COPYING3. If not see #include "tree-ssa.h" #include "cfgloop.h" +/* Disable warnings about missing quoting in GCC diagnostics. */ +#if __GNUC__ >= 10 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wformat-diag" +#endif + /* A pointer to one of the hooks containers. */ static struct cfg_hooks *cfg_hooks; @@ -1491,3 +1497,7 @@ profile_record_account_profile (profile_record *record) cfg_hooks->account_profile_record (bb, record); } } + +#if __GNUC__ >= 10 +# pragma GCC diagnostic pop +#endif diff --git a/gcc/cfgloop.c b/gcc/cfgloop.c index e115de6aae2..1677f677d72 100644 --- a/gcc/cfgloop.c +++ b/gcc/cfgloop.c @@ -1363,6 +1363,14 @@ cancel_loop_tree (struct loop *loop) cancel_loop (loop); } +/* Disable warnings about missing quoting in GCC diagnostics for + the verification errors. Their format strings don't follow + GCC diagnostic conventions and trigger an ICE in the end. */ +#if __GNUC__ >= 10 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wformat-diag" +#endif + /* Checks that information about loops is correct -- sizes of loops are all right -- results of get_loop_body really belong to the loop @@ -1677,7 +1685,7 @@ verify_loop_structure (void) if (eloops != 0) { - error ("wrong list of exited loops for edge %d->%d", + error ("wrong list of exited loops for edge %d->%d", e->src->index, e->dest->index); err = 1; } @@ -1712,6 +1720,10 @@ verify_loop_structure (void) free_dominance_info (CDI_DOMINATORS); } +#if __GNUC__ >= 10 +# pragma GCC diagnostic pop +#endif + /* Returns latch edge of LOOP. */ edge loop_latch_edge (const struct loop *loop) diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c index e06fb8d5a40..a1ca5992c41 100644 --- a/gcc/cfgrtl.c +++ b/gcc/cfgrtl.c @@ -62,6 +62,12 @@ along with GCC; see the file COPYING3. If not see #include "tree-pass.h" #include "print-rtl.h" +/* Disable warnings about missing quoting in GCC diagnostics. */ +#if __GNUC__ >= 10 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wformat-diag" +#endif + /* Holds the interesting leading and trailing notes for the function. Only applicable if the CFG is in cfglayout mode. */ static GTY(()) rtx_insn *cfg_layout_function_footer; @@ -5191,3 +5197,7 @@ struct cfg_hooks cfg_layout_rtl_cfg_hooks = { }; #include "gt-cfgrtl.h" + +#if __GNUC__ >= 10 +# pragma GCC diagnostic pop +#endif diff --git a/gcc/cgraph.c b/gcc/cgraph.c index b1b0b4c42d5..8761c72106d 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -3095,6 +3095,14 @@ cgraph_edge::verify_corresponds_to_fndecl (tree decl) return false; } +/* Disable warnings about missing quoting in GCC diagnostics for + the verification errors. Their format strings don't follow + GCC diagnostic conventions and trigger an ICE in the end. */ +#if __GNUC__ >= 10 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wformat-diag" +#endif + /* Verify cgraph nodes of given cgraph node. */ DEBUG_FUNCTION void cgraph_node::verify_node (void) @@ -3470,6 +3478,10 @@ cgraph_node::verify_cgraph_nodes (void) node->verify (); } +#if __GNUC__ >= 10 +# pragma GCC diagnostic pop +#endif + /* Walk the alias chain to return the function cgraph_node is alias of. Walk through thunks, too. When AVAILABILITY is non-NULL, get minimal availability in the chain. diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index 8bfbd0bb12f..6c4173fd8f0 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -796,8 +796,8 @@ process_function_and_variable_attributes (cgraph_node *first, /* redefining extern inline function makes it DECL_UNINLINABLE. */ && !DECL_UNINLINABLE (decl)) warning_at (DECL_SOURCE_LOCATION (decl), OPT_Wattributes, - "always_inline function might not be inlinable"); - + "% function might not be inlinable"); + process_common_attributes (node, decl); } for (vnode = symtab->first_variable (); vnode != first_var; diff --git a/gcc/collect-utils.c b/gcc/collect-utils.c index 1b1b27c9251..228b17e319f 100644 --- a/gcc/collect-utils.c +++ b/gcc/collect-utils.c @@ -180,7 +180,7 @@ collect_execute (const char *prog, char **argv, const char *outname, pex = pex_init (0, "collect2", NULL); if (pex == NULL) - fatal_error (input_location, "pex_init failed: %m"); + fatal_error (input_location, "% failed: %m"); errmsg = pex_run (pex, flags, argv[0], argv, outname, errname, &err); diff --git a/gcc/collect2.c b/gcc/collect2.c index eb84f84639b..b622eb25eea 100644 --- a/gcc/collect2.c +++ b/gcc/collect2.c @@ -701,7 +701,8 @@ maybe_run_lto_and_relink (char **lto_ld_argv, char **object_lst, size_t num_files; if (!lto_wrapper) - fatal_error (input_location, "COLLECT_LTO_WRAPPER must be set"); + fatal_error (input_location, "environment variable " + "% must be set"); num_lto_c_args++; @@ -2382,7 +2383,7 @@ is_lto_object_file (const char *prog_name) return true; if (errmsg) - fatal_error (0, "%s: %s\n", errmsg, xstrerror (err)); + fatal_error (0, "%s: %s", errmsg, xstrerror (err)); return false; } @@ -2448,7 +2449,7 @@ scan_prog_file (const char *prog_name, scanpass which_pass, pex = pex_init (PEX_USE_PIPES, "collect2", NULL); if (pex == NULL) - fatal_error (input_location, "pex_init failed: %m"); + fatal_error (input_location, "% failed: %m"); errmsg = pex_run (pex, 0, nm_file_name, real_nm_argv, NULL, HOST_BIT_BUCKET, &err); diff --git a/gcc/configure b/gcc/configure index 3cab176e501..6f9080af16a 100755 --- a/gcc/configure +++ b/gcc/configure @@ -6739,7 +6739,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu loose_warn= save_CXXFLAGS="$CXXFLAGS" -for real_option in -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual $wf_opt; do +for real_option in -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-error=format-diag $wf_opt; do # Do the check with the no- prefix removed since gcc silently # accepts any -Wno-* option on purpose case $real_option in @@ -6797,7 +6797,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu c_loose_warn= save_CFLAGS="$CFLAGS" -for real_option in -Wstrict-prototypes -Wmissing-prototypes; do +for real_option in -Wstrict-prototypes -Wmissing-prototypes-Wno-error=format-diag; do # Do the check with the no- prefix removed since gcc silently # accepts any -Wno-* option on purpose case $real_option in diff --git a/gcc/configure.ac b/gcc/configure.ac index 264f36fb78a..4bdccdb8ca6 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -483,10 +483,11 @@ AS_IF([test $enable_build_format_warnings = no], [wf_opt=-Wno-format],[wf_opt=]) ACX_PROG_CXX_WARNING_OPTS( m4_quote(m4_do([-W -Wall -Wno-narrowing -Wwrite-strings ], - [-Wcast-qual $wf_opt])), [loose_warn]) + [-Wcast-qual -Wno-error=format-diag $wf_opt])), + [loose_warn]) ACX_PROG_CC_WARNING_OPTS( - m4_quote(m4_do([-Wstrict-prototypes -Wmissing-prototypes])), - [c_loose_warn]) + m4_quote(m4_do([-Wstrict-prototypes -Wmissing-prototypes], + [-Wno-error=format-diag])), [c_loose_warn]) ACX_PROG_CXX_WARNING_OPTS( m4_quote(m4_do([-Wmissing-format-attribute ], [-Woverloaded-virtual])), [strict_warn]) diff --git a/gcc/convert.c b/gcc/convert.c index 32d475524d7..890af0e7a7c 100644 --- a/gcc/convert.c +++ b/gcc/convert.c @@ -415,11 +415,11 @@ convert_to_real_1 (tree type, tree expr, bool fold_p) case POINTER_TYPE: case REFERENCE_TYPE: - error ("pointer value used where a floating point value was expected"); + error ("pointer value used where a floating point was expected"); return convert_to_real_1 (type, integer_zero_node, fold_p); default: - error ("aggregate value used where a float was expected"); + error ("aggregate value used where a floating point was expected"); return convert_to_real_1 (type, integer_zero_node, fold_p); } } diff --git a/gcc/diagnostic-core.h b/gcc/diagnostic-core.h index efafde4fa24..4d46fbe2a02 100644 --- a/gcc/diagnostic-core.h +++ b/gcc/diagnostic-core.h @@ -52,7 +52,10 @@ extern const char *trim_filename (const char *); /* If we haven't already defined a front-end-specific diagnostics style, use the generic one. */ #ifndef GCC_DIAG_STYLE -#define GCC_DIAG_STYLE __gcc_tdiag__ +# define GCC_DIAG_STYLE __gcc_tdiag__ +#endif +#ifndef GCC_DIAG_RAW_STYLE +# define GCC_DIAG_RAW_STYLE __gcc_tdiag_raw__ #endif /* None of these functions are suitable for ATTRIBUTE_PRINTF, because each language front end can extend them with its own set of format diff --git a/gcc/diagnostic-show-locus.c b/gcc/diagnostic-show-locus.c index 205ee56f409..89074beb6d1 100644 --- a/gcc/diagnostic-show-locus.c +++ b/gcc/diagnostic-show-locus.c @@ -39,6 +39,13 @@ along with GCC; see the file COPYING3. If not see # include #endif +/* Disable warnings about quoting issues in the pp_xxx calls below + that (intentionally) don't follow GCC diagnostic conventions. */ +#if __GNUC__ >= 10 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wformat-diag" +#endif + /* Classes for rendering source code and diagnostics, within an anonymous namespace. The work is done by "class layout", which embeds and uses @@ -3740,3 +3747,7 @@ diagnostic_show_locus_c_tests () } // namespace selftest #endif /* #if CHECKING_P */ + +#if __GNUC__ >= 10 +# pragma GCC diagnostic pop +#endif diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c index be6b65722cd..4761b4349d3 100644 --- a/gcc/diagnostic.c +++ b/gcc/diagnostic.c @@ -43,6 +43,13 @@ along with GCC; see the file COPYING3. If not see # include #endif +/* Disable warnings about quoting issues in the pp_xxx calls below + that (intentionally) don't follow GCC diagnostic conventions. */ +#if __GNUC__ >= 10 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wformat-diag" +#endif + #define pedantic_warning_kind(DC) \ ((DC)->pedantic_errors ? DK_ERROR : DK_WARNING) #define permissive_error_kind(DC) ((DC)->permissive ? DK_WARNING : DK_ERROR) @@ -1861,3 +1868,7 @@ diagnostic_c_tests () } // namespace selftest #endif /* #if CHECKING_P */ + +#if __GNUC__ >= 10 +# pragma GCC diagnostic pop +#endif diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index e5d8ebc6a11..dced32950c8 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -1115,7 +1115,7 @@ dwarf2out_begin_prologue (unsigned int line ATTRIBUTE_UNUSED, function anymore. */ if (personality && current_unit_personality != personality) sorry ("multiple EH personalities are supported only with assemblers " - "supporting .cfi_personality directive"); + "supporting %<.cfi_personality%> directive"); } } diff --git a/gcc/except.c b/gcc/except.c index e760c4467dd..edaeeb4cfd1 100644 --- a/gcc/except.c +++ b/gcc/except.c @@ -3412,7 +3412,7 @@ verify_eh_tree (struct function *fun) count_r++; else { - error ("region_array is corrupted for region %i", r->index); + error ("% is corrupted for region %i", r->index); err = true; } } @@ -3425,7 +3425,7 @@ verify_eh_tree (struct function *fun) count_lp++; else { - error ("lp_array is corrupted for lp %i", lp->index); + error ("% is corrupted for lp %i", lp->index); err = true; } } @@ -3437,7 +3437,7 @@ verify_eh_tree (struct function *fun) { if ((*fun->eh->region_array)[r->index] != r) { - error ("region_array is corrupted for region %i", r->index); + error ("% is corrupted for region %i", r->index); err = true; } if (r->outer != outer) @@ -3456,7 +3456,7 @@ verify_eh_tree (struct function *fun) { if ((*fun->eh->lp_array)[lp->index] != lp) { - error ("lp_array is corrupted for lp %i", lp->index); + error ("% is corrupted for lp %i", lp->index); err = true; } if (lp->region != r) @@ -3493,19 +3493,19 @@ verify_eh_tree (struct function *fun) } if (count_r != nvisited_r) { - error ("region_array does not match region_tree"); + error ("% does not match %"); err = true; } if (count_lp != nvisited_lp) { - error ("lp_array does not match region_tree"); + error ("% does not match %"); err = true; } if (err) { dump_eh_tree (stderr, fun); - internal_error ("verify_eh_tree failed"); + internal_error ("%qs failed", __func__); } } diff --git a/gcc/gcc.c b/gcc/gcc.c index cee9d68cbee..2c2af197400 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -3198,7 +3198,7 @@ execute (void) ? PEX_RECORD_TIMES : 0), progname, temp_filename); if (pex == NULL) - fatal_error (input_location, "pex_init failed: %m"); + fatal_error (input_location, "% failed: %m"); for (i = 0; i < n_commands; i++) { @@ -6138,7 +6138,8 @@ eval_spec_function (const char *func, const char *args, alloc_args (); if (do_spec_2 (args, soft_matched_part) < 0) - fatal_error (input_location, "error in args to spec function %qs", func); + fatal_error (input_location, "error in arguments to spec function %qs", + func); /* argbuf_index is an index for the next argument to be inserted, and so contains the count of the args already inserted. */ @@ -6923,7 +6924,7 @@ run_attempt (const char **new_argv, const char *out_temp, pex = pex_init (PEX_USE_PIPES, new_argv[0], NULL); if (!pex) - fatal_error (input_location, "pex_init failed: %m"); + fatal_error (input_location, "% failed: %m"); errmsg = pex_run (pex, pex_flags, new_argv[0], CONST_CAST2 (char *const *, const char **, &new_argv[1]), @@ -7614,7 +7615,8 @@ driver::set_up_specs () const && do_spec_2 (sysroot_suffix_spec, NULL) == 0) { if (argbuf.length () > 1) - error ("spec failure: more than one arg to SYSROOT_SUFFIX_SPEC"); + error ("spec failure: more than one argument to " + "%"); else if (argbuf.length () == 1) target_sysroot_suffix = xstrdup (argbuf.last ()); } @@ -7638,7 +7640,8 @@ driver::set_up_specs () const && do_spec_2 (sysroot_hdrs_suffix_spec, NULL) == 0) { if (argbuf.length () > 1) - error ("spec failure: more than one arg to SYSROOT_HEADERS_SUFFIX_SPEC"); + error ("spec failure: more than one argument " + "to %"); else if (argbuf.length () == 1) target_sysroot_hdrs_suffix = xstrdup (argbuf.last ()); } @@ -9797,7 +9800,7 @@ compare_debug_auxbase_opt_spec_function (int arg, len = strlen (argv[0]); if (len < 3 || strcmp (argv[0] + len - 3, ".gk") != 0) fatal_error (input_location, "argument to %%:compare-debug-auxbase-opt " - "does not end in .gk"); + "does not end in %<.gk%>"); if (debug_auxbase_opt) return debug_auxbase_opt; diff --git a/gcc/gcov-tool.c b/gcc/gcov-tool.c index 5bb1ccac6be..fec256b9f72 100644 --- a/gcc/gcov-tool.c +++ b/gcc/gcov-tool.c @@ -70,7 +70,7 @@ unlink_gcda_file (const char *name, ret = remove (name); if (ret) - fatal_error (input_location, "error in removing %s\n", name); + fatal_error (input_location, "error in removing %s", name); return ret; } @@ -220,7 +220,7 @@ do_merge (int argc, char **argv) case 'w': sscanf (optarg, "%d,%d", &w1, &w2); if (w1 < 0 || w2 < 0) - fatal_error (input_location, "weights need to be non-negative\n"); + fatal_error (input_location, "weights need to be non-negative"); break; default: merge_usage (); @@ -355,7 +355,7 @@ do_rewrite (int argc, char **argv) } if (scale < 0.0) - fatal_error (input_location, "scale needs to be non-negative\n"); + fatal_error (input_location, "scale needs to be non-negative"); if (normalize_val != 0) { diff --git a/gcc/gcse.c b/gcc/gcse.c index 7fbdd675005..ff2771bdc04 100644 --- a/gcc/gcse.c +++ b/gcc/gcse.c @@ -4004,7 +4004,8 @@ gcse_or_cprop_is_too_expensive (const char *pass) if (memory_request > MAX_GCSE_MEMORY) { warning (OPT_Wdisabled_optimization, - "%s: %d basic blocks and %d registers; increase --param max-gcse-memory above %d", + "%s: %d basic blocks and %d registers; " + "increase %<--param max-gcse-memory%> above %d", pass, n_basic_blocks_for_fn (cfun), max_reg_num (), memory_request); diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c index 58212c4dcc1..218e652de05 100644 --- a/gcc/gimple-pretty-print.c +++ b/gcc/gimple-pretty-print.c @@ -43,6 +43,13 @@ along with GCC; see the file COPYING3. If not see #include "asan.h" #include "cfgloop.h" +/* Disable warnings about quoting issues in the pp_xxx calls below + that (intentionally) don't follow GCC diagnostic conventions. */ +#if __GNUC__ >= 10 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wformat-diag" +#endif + #define INDENT(SPACE) \ do { int i; for (i = 0; i < SPACE; i++) pp_space (buffer); } while (0) @@ -2958,3 +2965,7 @@ percent_G_format (text_info *text) tree block = gimple_block (stmt); percent_K_format (text, gimple_location (stmt), block); } + +#if __GNUC__ >= 10 +# pragma GCC diagnostic pop +#endif diff --git a/gcc/gimplify.c b/gcc/gimplify.c index b6c60855351..bc2000d4d80 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -6177,7 +6177,7 @@ gimplify_asm_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p) fb_lvalue | fb_mayfail); if (tret == GS_ERROR) { - error ("invalid lvalue in asm output %d", i); + error ("invalid lvalue in % output %d", i); ret = tret; } @@ -9835,7 +9835,7 @@ gimplify_adjust_omp_clauses (gimple_seq *pre_p, gimple_seq body, tree *list_p, { warning_at (OMP_CLAUSE_LOCATION (c), 0, "incompatible data clause with reduction " - "on %qE; promoting to present_or_copy", + "on %qE; promoting to %", DECL_NAME (t)); OMP_CLAUSE_SET_MAP_KIND (c, GOMP_MAP_TOFROM); } diff --git a/gcc/graph.c b/gcc/graph.c index 89b20312968..4858b259d80 100644 --- a/gcc/graph.c +++ b/gcc/graph.c @@ -57,6 +57,13 @@ open_graph_file (const char *base, const char *mode) return fp; } +/* Disable warnings about quoting issues in the pp_xxx calls below + that (intentionally) don't follow GCC diagnostic conventions. */ +#if __GNUC__ >= 10 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wformat-diag" +#endif + /* Draw a basic block BB belonging to the function with FUNCDEF_NO as its unique number. */ static void @@ -381,3 +388,7 @@ finish_graph_dump_file (const char *base) end_graph_dump (fp); fclose (fp); } + +#if __GNUC__ >= 10 +# pragma GCC diagnostic pop +#endif diff --git a/gcc/hsa-gen.c b/gcc/hsa-gen.c index edcec10f49f..f52c49c3fa2 100644 --- a/gcc/hsa-gen.c +++ b/gcc/hsa-gen.c @@ -2264,7 +2264,7 @@ gen_hsa_addr_insns (tree val, hsa_op_reg *dest, hsa_bb *hbb) { HSA_SORRY_ATV (EXPR_LOCATION (val), "support for HSA does " "not implement taking addresses of complex " - "CONST_DECLs such as %E", val); + "% such as %E", val); return; } @@ -2449,7 +2449,7 @@ gen_hsa_insns_for_load (hsa_op_reg *dest, tree rhs, tree type, hsa_bb *hbb) { HSA_SORRY_ATV (EXPR_LOCATION (rhs), "support for HSA does not implement conversion " - "of %E to the requested non-pointer type.", rhs); + "of %E to the requested non-pointer type", rhs); return; } @@ -3012,7 +3012,7 @@ gen_hsa_cmp_insn_from_gimple (enum tree_code code, tree lhs, tree rhs, default: HSA_SORRY_ATV (EXPR_LOCATION (lhs), "support for HSA does not implement comparison tree " - "code %s\n", get_tree_code_name (code)); + "code %s", get_tree_code_name (code)); return; } @@ -3162,8 +3162,8 @@ gen_hsa_insns_for_operation_assignment (gimple *assign, hsa_bb *hbb) case FLOOR_DIV_EXPR: case ROUND_DIV_EXPR: HSA_SORRY_AT (gimple_location (assign), - "support for HSA does not implement CEIL_DIV_EXPR, " - "FLOOR_DIV_EXPR or ROUND_DIV_EXPR"); + "support for HSA does not implement %, " + "% or %"); return; case TRUNC_MOD_EXPR: opcode = BRIG_OPCODE_REM; @@ -3172,8 +3172,8 @@ gen_hsa_insns_for_operation_assignment (gimple *assign, hsa_bb *hbb) case FLOOR_MOD_EXPR: case ROUND_MOD_EXPR: HSA_SORRY_AT (gimple_location (assign), - "support for HSA does not implement CEIL_MOD_EXPR, " - "FLOOR_MOD_EXPR or ROUND_MOD_EXPR"); + "support for HSA does not implement %, " + "% or %"); return; case NEGATE_EXPR: opcode = BRIG_OPCODE_NEG; @@ -4188,8 +4188,8 @@ gen_get_level (gimple *stmt, hsa_bb *hbb) if (shadow_reg_ptr == NULL) { HSA_SORRY_AT (gimple_location (stmt), - "support for HSA does not implement omp_get_level called " - "from a function not being inlined within a kernel"); + "support for HSA does not implement % " + "called from a function not being inlined within a kernel"); return; } @@ -4230,7 +4230,8 @@ gen_hsa_alloca (gcall *call, hsa_bb *hbb) if (lhs == NULL_TREE) return; - built_in_function fn = DECL_FUNCTION_CODE (gimple_call_fndecl (call)); + tree fndecl = gimple_call_fndecl (call); + built_in_function fn = DECL_FUNCTION_CODE (fndecl); gcc_checking_assert (ALLOCA_FUNCTION_CODE_P (fn)); @@ -4243,8 +4244,8 @@ gen_hsa_alloca (gcall *call, hsa_bb *hbb) { HSA_SORRY_ATV (gimple_location (call), "support for HSA does not implement " - "__builtin_alloca_with_align with a non-constant " - "alignment: %E", alignment_tree); + "%qD with a non-constant alignment %E", + fndecl, alignment_tree); } bit_alignment = tree_to_uhwi (alignment_tree); @@ -4548,7 +4549,7 @@ omp_simple_builtin::generate (gimple *stmt, hsa_bb *hbb) HSA_SORRY_AT (gimple_location (stmt), m_warning_message); else HSA_SORRY_ATV (gimple_location (stmt), - "Support for HSA does not implement calls to %s\n", + "support for HSA does not implement calls to %qs", m_name); } else if (m_warning_message != NULL) @@ -5049,7 +5050,7 @@ gen_hsa_atomic_for_builtin (bool ret_orig, enum BrigAtomicOperation acode, { HSA_SORRY_ATV (gimple_location (stmt), "support for HSA does not implement memory model for " - "ATOMIC_ST: %s", mmname); + "%: %s", mmname); return; } } @@ -5314,8 +5315,8 @@ gen_hsa_insns_for_call (gimple *stmt, hsa_bb *hbb) gen_hsa_insns_for_direct_call (stmt, hbb); else if (!gen_hsa_insns_for_known_library_call (stmt, hbb)) HSA_SORRY_AT (gimple_location (stmt), - "HSA supports only calls of functions marked with pragma " - "omp declare target"); + "HSA supports only calls of functions marked with " + "%<#pragma omp declare target%>"); return; } @@ -5625,7 +5626,7 @@ gen_hsa_insns_for_call (gimple *stmt, hsa_bb *hbb) case BUILT_IN_GOMP_PARALLEL: HSA_SORRY_AT (gimple_location (stmt), "support for HSA does not implement non-gridified " - "OpenMP parallel constructs."); + "OpenMP parallel constructs"); break; case BUILT_IN_OMP_GET_THREAD_NUM: diff --git a/gcc/input.c b/gcc/input.c index c589d70c2bb..1e84d2ee2d1 100644 --- a/gcc/input.c +++ b/gcc/input.c @@ -1215,7 +1215,8 @@ dump_location_info (FILE *stream) if (x == y) { if (x < MAP_START_LOCATION (map)) - inform (x, "token %u has x-location == y-location == %u", i, x); + inform (x, "token %u has %", + i, x); else fprintf (stream, "x-location == y-location == %u encodes token # %u\n", @@ -1223,8 +1224,8 @@ dump_location_info (FILE *stream) } else { - inform (x, "token %u has x-location == %u", i, x); - inform (x, "token %u has y-location == %u", i, y); + inform (x, "token %u has %", i, x); + inform (x, "token %u has %", i, y); } } fprintf (stream, "\n"); diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c index 3e040e27305..a51b1517422 100644 --- a/gcc/ipa-devirt.c +++ b/gcc/ipa-devirt.c @@ -947,7 +947,7 @@ compare_virtual_tables (varpool_node *prevailing, varpool_node *vtable) if (warning_at (DECL_SOURCE_LOCATION (TYPE_NAME (DECL_CONTEXT (vtable->decl))), OPT_Wodr, "virtual table of type %qD violates " - "one definition rule ", + "one definition rule", DECL_CONTEXT (vtable->decl))) { if (TREE_CODE (ref1->referred->decl) == FUNCTION_DECL) diff --git a/gcc/ira.c b/gcc/ira.c index fd481d6e0e2..4a14fb31583 100644 --- a/gcc/ira.c +++ b/gcc/ira.c @@ -2326,7 +2326,7 @@ ira_setup_eliminable_regset (void) SET_HARD_REG_BIT (ira_no_alloc_regs, eliminables[i].from); } else if (cannot_elim) - error ("%s cannot be used in asm here", + error ("%s cannot be used in % here", reg_names[eliminables[i].from]); else df_set_regs_ever_live (eliminables[i].from, true); @@ -2340,7 +2340,7 @@ ira_setup_eliminable_regset (void) SET_HARD_REG_BIT (ira_no_alloc_regs, HARD_FRAME_POINTER_REGNUM); } else if (frame_pointer_needed) - error ("%s cannot be used in asm here", + error ("%s cannot be used in % here", reg_names[HARD_FRAME_POINTER_REGNUM]); else df_set_regs_ever_live (HARD_FRAME_POINTER_REGNUM, true); diff --git a/gcc/lra-assigns.c b/gcc/lra-assigns.c index 8b56b58fb2e..609feec48ae 100644 --- a/gcc/lra-assigns.c +++ b/gcc/lra-assigns.c @@ -1692,7 +1692,7 @@ lra_assign (bool &fails_p) && (lra_assignment_iter_after_spill > LRA_MAX_ASSIGNMENT_ITERATION_NUMBER)) internal_error - ("Maximum number of LRA assignment passes is achieved (%d)\n", + ("maximum number of LRA assignment passes is achieved (%d)", LRA_MAX_ASSIGNMENT_ITERATION_NUMBER); return no_spills_p; } diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c index cf33da8013e..d1d99e01cde 100644 --- a/gcc/lra-constraints.c +++ b/gcc/lra-constraints.c @@ -4898,7 +4898,7 @@ lra_constraints (bool first_p) } if (new_insns_num > MAX_RELOAD_INSNS_NUMBER) internal_error - ("Max. number of generated reload insns per insn is achieved (%d)\n", + ("maximum number of generated reload insns per insn achieved (%d)", MAX_RELOAD_INSNS_NUMBER); new_insns_num++; if (DEBUG_INSN_P (curr_insn)) diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c index 7727b9be760..b78b7cb1ad2 100644 --- a/gcc/lto-streamer-in.c +++ b/gcc/lto-streamer-in.c @@ -1700,7 +1700,7 @@ lto_input_mode_table (struct lto_file_decl_data *file_data) } /* FALLTHRU */ default: - fatal_error (UNKNOWN_LOCATION, "unsupported mode %s\n", mname); + fatal_error (UNKNOWN_LOCATION, "unsupported mode %qs", mname); break; } } diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c index ac971494054..9eff9fd8570 100644 --- a/gcc/lto-wrapper.c +++ b/gcc/lto-wrapper.c @@ -155,7 +155,8 @@ get_options_from_collect_gcc_options (const char *collect_gcc, do { if (argv_storage[j] == '\0') - fatal_error (input_location, "malformed COLLECT_GCC_OPTIONS"); + fatal_error (input_location, + "malformed %"); else if (strncmp (&argv_storage[j], "'\\''", 4) == 0) { argv_storage[k++] = '\''; @@ -310,7 +311,7 @@ merge_and_complain (struct cl_decoded_option **decoded_options, append_option (decoded_options, decoded_options_count, foption); else if (strcmp ((*decoded_options)[j].arg, foption->arg)) fatal_error (input_location, - "Option %s with different values", + "option %s with different values", foption->orig_option_with_args_text); break; @@ -394,7 +395,7 @@ merge_and_complain (struct cl_decoded_option **decoded_options, append_option (decoded_options, decoded_options_count, foption); else if (foption->value != (*decoded_options)[j].value) fatal_error (input_location, - "Option %s not used consistently in all LTO input" + "option %s not used consistently in all LTO input" " files", foption->orig_option_with_args_text); break; @@ -822,7 +823,7 @@ compile_offload_image (const char *target, const char *compiler_path, if (!compiler) fatal_error (input_location, - "could not find %s in %s (consider using %<-B%>)\n", + "could not find %s in %s (consider using %<-B%>)", suffix + 1, compiler_path); /* Generate temporary output file name. */ @@ -903,7 +904,7 @@ compile_images_for_offload_targets (unsigned in_argc, char *in_argv[], linker_opts, linker_opt_count); if (!offload_names[next_name_entry]) fatal_error (input_location, - "problem with building target image for %s\n", names[i]); + "problem with building target image for %s", names[i]); next_name_entry++; } @@ -1072,7 +1073,7 @@ debug_objcopy (const char *infile, bool rename) &off, &len, &errmsg, &err) != 1) { if (errmsg) - fatal_error (0, "%s: %s\n", errmsg, xstrerror (err)); + fatal_error (0, "%s: %s", errmsg, xstrerror (err)); simple_object_release_read (inobj); close (infd); @@ -1092,7 +1093,7 @@ debug_objcopy (const char *infile, bool rename) if (errmsg) { unlink_if_ordinary (outfile); - fatal_error (0, "%s: %s\n", errmsg, xstrerror (err)); + fatal_error (0, "%s: %s", errmsg, xstrerror (err)); } simple_object_release_read (inobj); @@ -1144,11 +1145,11 @@ run_gcc (unsigned argc, char *argv[]) collect_gcc = getenv ("COLLECT_GCC"); if (!collect_gcc) fatal_error (input_location, - "environment variable COLLECT_GCC must be set"); + "environment variable % must be set"); collect_gcc_options = getenv ("COLLECT_GCC_OPTIONS"); if (!collect_gcc_options) fatal_error (input_location, - "environment variable COLLECT_GCC_OPTIONS must be set"); + "environment variable % must be set"); get_options_from_collect_gcc_options (collect_gcc, collect_gcc_options, CL_LANG_ALL, &decoded_options, @@ -1548,7 +1549,7 @@ cont1: int priority; if (!stream) - fatal_error (input_location, "fopen: %s: %m", ltrans_output_file); + fatal_error (input_location, "%: %s: %m", ltrans_output_file); /* Parse the list of LTRANS inputs from the WPA stage. */ obstack_init (&env_obstack); @@ -1565,7 +1566,7 @@ cont1: { if (!feof (stream)) fatal_error (input_location, - "Corrupted ltrans output file %s", + "corrupted ltrans output file %s", ltrans_output_file); break; } @@ -1754,7 +1755,7 @@ main (int argc, char *argv[]) diagnostic_initialize (global_dc, 0); if (atexit (lto_wrapper_cleanup) != 0) - fatal_error (input_location, "atexit failed"); + fatal_error (input_location, "% failed"); if (signal (SIGINT, SIG_IGN) != SIG_IGN) signal (SIGINT, fatal_signal); diff --git a/gcc/lto/lto-dump.c b/gcc/lto/lto-dump.c index 39b442335f6..691d109ff34 100644 --- a/gcc/lto/lto-dump.c +++ b/gcc/lto/lto-dump.c @@ -320,7 +320,8 @@ lto_main (void) node->get_untransformed_body (); if (!GATHER_STATISTICS) warning_at (input_location, 0, - "Not configured with --enable-gather-detailed-mem-stats."); + "Not configured with " + "%<--enable-gather-detailed-mem-stats%>."); else dump_gimple_statistics (); } @@ -329,7 +330,8 @@ lto_main (void) /* Dump tree statistics. */ if (!GATHER_STATISTICS) warning_at (input_location, 0, - "Not configured with --enable-gather-detailed-mem-stats."); + "Not configured with " + "%<--enable-gather-detailed-mem-stats%>."); else { printf ("Tree Statistics\n"); diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c index bf790209701..814f03a1777 100644 --- a/gcc/lto/lto.c +++ b/gcc/lto/lto.c @@ -159,7 +159,7 @@ stream_out (char *temp_filename, lto_symtab_encoder_t encoder, int part) { lto_file *file = lto_obj_file_open (temp_filename, true); if (!file) - fatal_error (input_location, "lto_obj_file_open() failed"); + fatal_error (input_location, "% failed"); lto_set_current_out_file (file); gcc_assert (!dump_file); diff --git a/gcc/opts.c b/gcc/opts.c index 71adc21cb26..879ab17c362 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -1671,7 +1671,8 @@ print_specific_help (unsigned int include_flags, description = _("The following options take joined arguments"); else { - internal_error ("unrecognized include_flags 0x%x passed to print_specific_help", + internal_error ("unrecognized % passed " + "to %", include_flags); return; } @@ -1982,7 +1983,7 @@ parse_no_sanitize_attribute (char *value) if (sanitizer_opts[i].name == NULL) warning (OPT_Wattributes, - "%<%s%> attribute directive ignored", q); + "%qs attribute directive ignored", q); q = strtok (NULL, ","); } @@ -2165,7 +2166,7 @@ print_help (struct gcc_options *opts, unsigned int lang_mask) *pflags |= lang_flag; else warning (0, - "--help argument %q.*s is ambiguous, " + "%<--help%> argument %q.*s is ambiguous, " "please be more specific", len, a); } @@ -2174,7 +2175,7 @@ print_help (struct gcc_options *opts, unsigned int lang_mask) *pflags |= lang_flag; else warning (0, - "unrecognized argument to --help= option: %q.*s", + "unrecognized argument to %<--help=%> option: %q.*s", len, a); if (comma == NULL) @@ -2831,8 +2832,8 @@ handle_param (struct gcc_options *opts, struct gcc_options *opts_set, arg = xstrdup (carg); equal = strchr (arg, '='); if (!equal) - error_at (loc, "%s: --param arguments should be of the form NAME=VALUE", - arg); + error_at (loc, "%s: %qs arguments should be of the form NAME=VALUE", + arg, "--param"); else { *equal = '\0'; @@ -2842,10 +2843,10 @@ handle_param (struct gcc_options *opts, struct gcc_options *opts_set, { const char *suggestion = find_param_fuzzy (arg); if (suggestion) - error_at (loc, "invalid --param name %qs; did you mean %qs?", - arg, suggestion); + error_at (loc, "invalid %qs name %qs; did you mean %qs?", + "--param", arg, suggestion); else - error_at (loc, "invalid --param name %qs", arg); + error_at (loc, "invalid %qs name %qs", "--param", arg); } else { @@ -2853,7 +2854,7 @@ handle_param (struct gcc_options *opts, struct gcc_options *opts_set, value = integral_argument (equal + 1); if (value == -1) - error_at (loc, "invalid --param value %qs", equal + 1); + error_at (loc, "invalid %qs value %qs", "--param", equal + 1); else set_param_value (arg, value, opts->x_param_values, opts_set->x_param_values); diff --git a/gcc/passes.c b/gcc/passes.c index a9c22889d71..c6331cbc49d 100644 --- a/gcc/passes.c +++ b/gcc/passes.c @@ -87,8 +87,8 @@ opt_pass::clone () void opt_pass::set_pass_param (unsigned int, bool) { - internal_error ("pass %s needs a set_pass_param implementation to handle the" - " extra argument in NEXT_PASS", name); + internal_error ("pass %s needs a % implementation " + "to handle the extra argument in %", name); } bool diff --git a/gcc/plugin.c b/gcc/plugin.c index 2896c6a9392..f3079760236 100644 --- a/gcc/plugin.c +++ b/gcc/plugin.c @@ -231,7 +231,7 @@ add_new_plugin (const char* plugin_name) { plugin = (struct plugin_name_args *) *slot; if (strcmp (plugin->full_name, plugin_name)) - error ("plugin %s was specified with different paths:\n%s\n%s", + error ("plugin %qs was specified with different paths: %qs and %qs", plugin->base_name, plugin->full_name, plugin_name); return; } @@ -290,7 +290,8 @@ parse_plugin_arg_opt (const char *arg) if (!key_start) { - error ("malformed option %<-fplugin-arg-%s%> (missing -[=])", + error ("malformed option %<-fplugin-arg-%s%>: " + "missing %<-[=]%>", arg); return; } @@ -700,7 +701,7 @@ try_init_one_plugin (struct plugin_name_args *plugin) dl_handle = dlopen (plugin->full_name, RTLD_NOW | RTLD_GLOBAL); if (!dl_handle) { - error ("cannot load plugin %s\n%s", plugin->full_name, dlerror ()); + error ("cannot load plugin %s: %s", plugin->full_name, dlerror ()); return false; } @@ -710,7 +711,7 @@ try_init_one_plugin (struct plugin_name_args *plugin) /* Check the plugin license. */ if (dlsym (dl_handle, str_license) == NULL) fatal_error (input_location, - "plugin %s is not licensed under a GPL-compatible license\n" + "plugin %s is not licensed under a GPL-compatible license" "%s", plugin->full_name, dlerror ()); PTR_UNION_AS_VOID_PTR (plugin_init_union) = @@ -720,7 +721,7 @@ try_init_one_plugin (struct plugin_name_args *plugin) if ((err = dlerror ()) != NULL) { dlclose(dl_handle); - error ("cannot find %s in plugin %s\n%s", str_plugin_init_func_name, + error ("cannot find %s in plugin %s: %s", str_plugin_init_func_name, plugin->full_name, err); return false; } @@ -729,7 +730,7 @@ try_init_one_plugin (struct plugin_name_args *plugin) if ((*plugin_init) (plugin, &gcc_version)) { dlclose(dl_handle); - error ("fail to initialize plugin %s", plugin->full_name); + error ("failed to initialize plugin %s", plugin->full_name); return false; } /* leak dl_handle on purpose to ensure the plugin is loaded for the diff --git a/gcc/pretty-print.h b/gcc/pretty-print.h index e4df6590719..71726bd0b88 100644 --- a/gcc/pretty-print.h +++ b/gcc/pretty-print.h @@ -355,11 +355,12 @@ extern void pp_newline_and_indent (pretty_printer *, int); extern void pp_separate_with (pretty_printer *, char); /* If we haven't already defined a front-end-specific diagnostics - style, use the generic one. */ -#ifdef GCC_DIAG_STYLE -#define GCC_PPDIAG_STYLE GCC_DIAG_STYLE + style, use the generic one for "raw" formatting (i.e., with no + checking of punctuation and quoting issues in the format string). */ +#ifdef GCC_DIAG_RAW_STYLE +#define GCC_PPDIAG_STYLE GCC_DIAG_RAW_STYLE #else -#define GCC_PPDIAG_STYLE __gcc_diag__ +#define GCC_PPDIAG_STYLE __gcc_diag_raw__ #endif /* This header may be included before diagnostics-core.h, hence the duplicate diff --git a/gcc/print-rtl.c b/gcc/print-rtl.c index fbb108568b3..10948efddd9 100644 --- a/gcc/print-rtl.c +++ b/gcc/print-rtl.c @@ -54,6 +54,13 @@ along with GCC; see the file COPYING3. If not see #include "print-rtl.h" #include "rtl-iter.h" +/* Disable warnings about quoting issues in the pp_xxx calls below + that (intentionally) don't follow GCC diagnostic conventions. */ +#if __GNUC__ >= 10 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wformat-diag" +#endif + /* String printed at beginning of each RTL when it is dumped. This string is set to ASM_COMMENT_START when the RTL is dumped in the assembly output file. */ @@ -2142,3 +2149,7 @@ debug_bb_n_slim (int n) } #endif + +#if __GNUC__ >= 10 +# pragma GCC diagnostic pop +#endif diff --git a/gcc/read-rtl-function.c b/gcc/read-rtl-function.c index 53f7a94c188..3cf34ba99a8 100644 --- a/gcc/read-rtl-function.c +++ b/gcc/read-rtl-function.c @@ -707,7 +707,7 @@ parse_edge_flag_token (const char *tok) } while (0); #include "cfg-flags.def" #undef DEF_EDGE_FLAG - error ("unrecognized edge flag: '%s'", tok); + error ("unrecognized edge flag: %qs", tok); return 0; } @@ -978,7 +978,7 @@ function_reader::parse_enum_value (int num_values, const char *const *strings) if (strcmp (name.string, strings[i]) == 0) return i; } - error ("unrecognized enum value: '%s'", name.string); + error ("unrecognized enum value: %qs", name.string); return 0; } diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c index 033c978a12f..8c934aaf936 100644 --- a/gcc/reg-stack.c +++ b/gcc/reg-stack.c @@ -545,7 +545,8 @@ check_asm_stack_operands (rtx_insn *insn) for (j = 0; j < n_clobbers; j++) if (REGNO (recog_data.operand[i]) == REGNO (clobber_reg[j])) { - error_for_asm (insn, "output constraint %d cannot be specified together with \"%s\" clobber", + error_for_asm (insn, "output constraint %d cannot be " + "specified together with %qs clobber", i, reg_names [REGNO (clobber_reg[j])]); malformed_asm = 1; break; @@ -568,7 +569,7 @@ check_asm_stack_operands (rtx_insn *insn) if (i != LAST_STACK_REG + 1) { - error_for_asm (insn, "output regs must be grouped at top of stack"); + error_for_asm (insn, "output registers must be grouped at top of stack"); malformed_asm = 1; } @@ -608,7 +609,8 @@ check_asm_stack_operands (rtx_insn *insn) if (i != LAST_STACK_REG + 1) { error_for_asm (insn, - "implicitly popped regs must be grouped at top of stack"); + "implicitly popped registers must be grouped " + "at top of stack"); malformed_asm = 1; } @@ -625,7 +627,8 @@ check_asm_stack_operands (rtx_insn *insn) if (i != LAST_STACK_REG + 1) { error_for_asm (insn, - "explicitly used regs must be grouped at top of stack"); + "explicitly used registers must be grouped " + "at top of stack"); malformed_asm = 1; } diff --git a/gcc/regcprop.c b/gcc/regcprop.c index 4842ce922bc..a18c24f4797 100644 --- a/gcc/regcprop.c +++ b/gcc/regcprop.c @@ -1216,8 +1216,8 @@ validate_value_data (struct value_data *vd) if (vd->e[i].mode == VOIDmode) { if (vd->e[i].next_regno != INVALID_REGNUM) - internal_error ("validate_value_data: [%u] Bad next_regno for empty chain (%u)", - i, vd->e[i].next_regno); + internal_error ("%qs: [%u] bad % for empty chain (%u)", + __func__, i, vd->e[i].next_regno); continue; } @@ -1228,11 +1228,11 @@ validate_value_data (struct value_data *vd) j = vd->e[j].next_regno) { if (TEST_HARD_REG_BIT (set, j)) - internal_error ("validate_value_data: Loop in regno chain (%u)", - j); + internal_error ("%qs: loop in % chain (%u)", + __func__, j); if (vd->e[j].oldest_regno != i) - internal_error ("validate_value_data: [%u] Bad oldest_regno (%u)", - j, vd->e[j].oldest_regno); + internal_error ("%qs: [%u] bad % (%u)", + __func__, j, vd->e[j].oldest_regno); SET_HARD_REG_BIT (set, j); } @@ -1243,8 +1243,9 @@ validate_value_data (struct value_data *vd) && (vd->e[i].mode != VOIDmode || vd->e[i].oldest_regno != i || vd->e[i].next_regno != INVALID_REGNUM)) - internal_error ("validate_value_data: [%u] Non-empty reg in chain (%s %u %i)", - i, GET_MODE_NAME (vd->e[i].mode), vd->e[i].oldest_regno, + internal_error ("%qs: [%u] non-empty register in chain (%s %u %i)", + __func__, i, + GET_MODE_NAME (vd->e[i].mode), vd->e[i].oldest_regno, vd->e[i].next_regno); } diff --git a/gcc/sched-rgn.c b/gcc/sched-rgn.c index 83688b3c9c4..d4001300a4b 100644 --- a/gcc/sched-rgn.c +++ b/gcc/sched-rgn.c @@ -67,6 +67,13 @@ along with GCC; see the file COPYING3. If not see #include "pretty-print.h" #include "print-rtl.h" +/* Disable warnings about quoting issues in the pp_xxx calls below + that (intentionally) don't follow GCC diagnostic conventions. */ +#if __GNUC__ >= 10 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wformat-diag" +#endif + #ifdef INSN_SCHEDULING /* Some accessor macros for h_i_d members only used within this file. */ @@ -3947,3 +3954,7 @@ make_pass_sched_fusion (gcc::context *ctxt) { return new pass_sched_fusion (ctxt); } + +#if __GNUC__ >= 10 +# pragma GCC diagnostic pop +#endif diff --git a/gcc/stmt.c b/gcc/stmt.c index b69d7c4f2ba..8ed3bf5aa2f 100644 --- a/gcc/stmt.c +++ b/gcc/stmt.c @@ -521,7 +521,7 @@ check_unique_operand_names (tree outputs, tree inputs, tree labels) return true; failure: - error ("duplicate asm operand name %qs", TREE_STRING_POINTER (i_name)); + error ("duplicate % operand name %qs", TREE_STRING_POINTER (i_name)); return false; } diff --git a/gcc/symtab.c b/gcc/symtab.c index 4bf37a18171..9d0b28bc717 100644 --- a/gcc/symtab.c +++ b/gcc/symtab.c @@ -1002,6 +1002,14 @@ symtab_node::debug (void) /* Verify common part of symtab nodes. */ +#if __GNUC__ >= 10 +/* Disable warnings about missing quoting in GCC diagnostics for + the verification errors. Their format strings don't follow + GCC diagnostic conventions and trigger an ICE in the end. */ +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wformat-diag" +#endif + DEBUG_FUNCTION bool symtab_node::verify_base (void) { @@ -1288,6 +1296,10 @@ symtab_node::verify_symtab_nodes (void) } } +#if __GNUC__ >= 10 +# pragma GCC diagnostic pop +#endif + /* Make DECL local. FIXME: We shouldn't need to mess with rtl this early, but other code such as notice_global_symbol generates rtl. */ diff --git a/gcc/targhooks.c b/gcc/targhooks.c index 02b9dc59611..577e373c578 100644 --- a/gcc/targhooks.c +++ b/gcc/targhooks.c @@ -1600,7 +1600,7 @@ default_target_option_pragma_parse (tree ARG_UNUSED (args), do not have the "target" pragma. */ if (args) warning (OPT_Wpragmas, - "#pragma GCC target is not supported for this machine"); + "%<#pragma GCC target%> is not supported for this machine"); return false; } diff --git a/gcc/testsuite/gcc.dg/format/gcc_diag-11.c b/gcc/testsuite/gcc.dg/format/gcc_diag-11.c new file mode 100644 index 00000000000..a716c8de7ef diff --git a/gcc/testsuite/gcc.dg/gcc_diag-11.c b/gcc/testsuite/gcc.dg/gcc_diag-11.c new file mode 100644 index 00000000000..c359989f481 diff --git a/gcc/tlink.c b/gcc/tlink.c index 16a7b152d4d..485000b5466 100644 --- a/gcc/tlink.c +++ b/gcc/tlink.c @@ -484,9 +484,11 @@ recompile_files (void) the new file name already exists. Therefore, we explicitly remove the old file first. */ if (remove (f->key) == -1) - fatal_error (input_location, "removing .rpo file: %m"); + fatal_error (input_location, + "removing repository file %qs: %m", f->key); if (rename (outname, f->key) == -1) - fatal_error (input_location, "renaming .rpo file: %m"); + fatal_error (input_location, "renaming repository file from " + "%qs to %qs: %m", outname, f->key); if (!f->args) { diff --git a/gcc/toplev.c b/gcc/toplev.c index 397a164068d..2103d74a0b5 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -1737,7 +1737,7 @@ process_options (void) { warning_at (UNKNOWN_LOCATION, 0, "%<-fstack-check=%> and %<-fstack-clash_protection%> are " - "mutually exclusive. Disabling %<-fstack-check=%>"); + "mutually exclusive; disabling %<-fstack-check=%>"); flag_stack_check = NO_STACK_CHECK; } @@ -2180,7 +2180,7 @@ do_compile () on the squared numbers. */ if (mpfr_set_emin (2 * (min_exp - 1)) || mpfr_set_emax (2 * (max_exp + 1))) - sorry ("mpfr not configured to handle all float modes"); + sorry ("mpfr not configured to handle all floating modes"); /* Set up the back-end if requested. */ if (!no_backend) diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c index 0581aae2d69..d16f5f9cad1 100644 --- a/gcc/trans-mem.c +++ b/gcc/trans-mem.c @@ -754,10 +754,10 @@ diagnose_tm_1 (gimple_stmt_iterator *gsi, bool *handled_ops_p, Either that or get the language spec to resurrect __tm_waiver. */ if (d->block_flags & DIAG_TM_SAFE) error_at (gimple_location (stmt), - "asm not allowed in atomic transaction"); + "% not allowed in atomic transaction"); else if (d->func_flags & DIAG_TM_SAFE) error_at (gimple_location (stmt), - "asm not allowed in % function"); + "% not allowed in % function"); break; case GIMPLE_TRANSACTION: @@ -4414,7 +4414,8 @@ ipa_tm_scan_irr_block (basic_block bb) { tree t = build1 (NOP_EXPR, void_type_node, size_zero_node); SET_EXPR_LOCATION (t, gimple_location (stmt)); - error ("%Kasm not allowed in % function", t); + error ("%K% not allowed in % function", + t); } return true; @@ -4788,7 +4789,7 @@ ipa_tm_diagnose_transaction (struct cgraph_node *node, if (gimple_code (stmt) == GIMPLE_ASM) { error_at (gimple_location (stmt), - "asm not allowed in atomic transaction"); + "% not allowed in atomic transaction"); continue; } diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 966ce5a373c..7c73d7adbde 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -2961,12 +2961,12 @@ verify_address (tree t, bool verify_addressable) if (old_constant != new_constant) { - error ("constant not recomputed when ADDR_EXPR changed"); + error ("constant not recomputed when % changed"); return true; } if (old_side_effects != new_side_effects) { - error ("side effects not recomputed when ADDR_EXPR changed"); + error ("side effects not recomputed when % changed"); return true; } @@ -2981,13 +2981,13 @@ verify_address (tree t, bool verify_addressable) if (DECL_GIMPLE_REG_P (base)) { - error ("DECL_GIMPLE_REG_P set on a variable with address taken"); + error ("% set on a variable with address taken"); return true; } if (verify_addressable && !TREE_ADDRESSABLE (base)) { - error ("address taken, but ADDRESSABLE bit not set"); + error ("address taken but % bit not set"); return true; } @@ -3036,6 +3036,8 @@ verify_types_in_gimple_min_lval (tree expr) static bool verify_types_in_gimple_reference (tree expr, bool require_lvalue) { + const char *code_name = get_tree_code_name (TREE_CODE (expr)); + if (TREE_CODE (expr) == REALPART_EXPR || TREE_CODE (expr) == IMAGPART_EXPR || TREE_CODE (expr) == BIT_FIELD_REF) @@ -3043,7 +3045,7 @@ verify_types_in_gimple_reference (tree expr, bool require_lvalue) tree op = TREE_OPERAND (expr, 0); if (!is_gimple_reg_type (TREE_TYPE (expr))) { - error ("non-scalar BIT_FIELD_REF, IMAGPART_EXPR or REALPART_EXPR"); + error ("non-scalar %qs", code_name); return true; } @@ -3057,14 +3059,14 @@ verify_types_in_gimple_reference (tree expr, bool require_lvalue) || !types_compatible_p (bitsizetype, TREE_TYPE (t1)) || !types_compatible_p (bitsizetype, TREE_TYPE (t2))) { - error ("invalid position or size operand to BIT_FIELD_REF"); + error ("invalid position or size operand to %qs", code_name); return true; } if (INTEGRAL_TYPE_P (TREE_TYPE (expr)) && maybe_ne (TYPE_PRECISION (TREE_TYPE (expr)), size)) { error ("integral result type precision does not match " - "field size of BIT_FIELD_REF"); + "field size of %qs", code_name); return true; } else if (!INTEGRAL_TYPE_P (TREE_TYPE (expr)) @@ -3073,13 +3075,14 @@ verify_types_in_gimple_reference (tree expr, bool require_lvalue) size)) { error ("mode size of non-integral result does not " - "match field size of BIT_FIELD_REF"); + "match field size of %qs", + code_name); return true; } if (INTEGRAL_TYPE_P (TREE_TYPE (op)) && !type_has_mode_precision_p (TREE_TYPE (op))) { - error ("BIT_FIELD_REF of non-mode-precision operand"); + error ("%qs of non-mode-precision operand", code_name); return true; } if (!AGGREGATE_TYPE_P (TREE_TYPE (op)) @@ -3087,7 +3090,7 @@ verify_types_in_gimple_reference (tree expr, bool require_lvalue) tree_to_poly_uint64 (TYPE_SIZE (TREE_TYPE (op))))) { error ("position plus size exceeds size of referenced object in " - "BIT_FIELD_REF"); + "%qs", code_name); return true; } } @@ -3097,7 +3100,7 @@ verify_types_in_gimple_reference (tree expr, bool require_lvalue) && !useless_type_conversion_p (TREE_TYPE (expr), TREE_TYPE (TREE_TYPE (op)))) { - error ("type mismatch in real/imagpart reference"); + error ("type mismatch in %qs reference", code_name); debug_generic_stmt (TREE_TYPE (expr)); debug_generic_stmt (TREE_TYPE (TREE_TYPE (op))); return true; @@ -3107,11 +3110,13 @@ verify_types_in_gimple_reference (tree expr, bool require_lvalue) while (handled_component_p (expr)) { + code_name = get_tree_code_name (TREE_CODE (expr)); + if (TREE_CODE (expr) == REALPART_EXPR || TREE_CODE (expr) == IMAGPART_EXPR || TREE_CODE (expr) == BIT_FIELD_REF) { - error ("non-top-level BIT_FIELD_REF, IMAGPART_EXPR or REALPART_EXPR"); + error ("non-top-level %qs", code_name); return true; } @@ -3126,7 +3131,7 @@ verify_types_in_gimple_reference (tree expr, bool require_lvalue) || (TREE_OPERAND (expr, 3) && !is_gimple_val (TREE_OPERAND (expr, 3)))) { - error ("invalid operands to array reference"); + error ("invalid operands to %qs", code_name); debug_generic_stmt (expr); return true; } @@ -3137,7 +3142,7 @@ verify_types_in_gimple_reference (tree expr, bool require_lvalue) && !useless_type_conversion_p (TREE_TYPE (expr), TREE_TYPE (TREE_TYPE (op)))) { - error ("type mismatch in array reference"); + error ("type mismatch in %qs", code_name); debug_generic_stmt (TREE_TYPE (expr)); debug_generic_stmt (TREE_TYPE (TREE_TYPE (op))); return true; @@ -3146,7 +3151,7 @@ verify_types_in_gimple_reference (tree expr, bool require_lvalue) && !useless_type_conversion_p (TREE_TYPE (TREE_TYPE (expr)), TREE_TYPE (TREE_TYPE (op)))) { - error ("type mismatch in array range reference"); + error ("type mismatch in %qs", code_name); debug_generic_stmt (TREE_TYPE (TREE_TYPE (expr))); debug_generic_stmt (TREE_TYPE (TREE_TYPE (op))); return true; @@ -3157,13 +3162,13 @@ verify_types_in_gimple_reference (tree expr, bool require_lvalue) if (TREE_OPERAND (expr, 2) && !is_gimple_val (TREE_OPERAND (expr, 2))) { - error ("invalid COMPONENT_REF offset operator"); + error ("invalid %qs offset operator", code_name); return true; } if (!useless_type_conversion_p (TREE_TYPE (expr), TREE_TYPE (TREE_OPERAND (expr, 1)))) { - error ("type mismatch in component reference"); + error ("type mismatch in %qs", code_name); debug_generic_stmt (TREE_TYPE (expr)); debug_generic_stmt (TREE_TYPE (TREE_OPERAND (expr, 1))); return true; @@ -3181,14 +3186,16 @@ verify_types_in_gimple_reference (tree expr, bool require_lvalue) && (TREE_CODE (op) == SSA_NAME || is_gimple_min_invariant (op))) { - error ("conversion of an SSA_NAME on the left hand side"); + error ("conversion of an %qs on the left hand side of %qs", + get_tree_code_name (TREE_CODE (op)), code_name); debug_generic_stmt (expr); return true; } else if (TREE_CODE (op) == SSA_NAME && TYPE_SIZE (TREE_TYPE (expr)) != TYPE_SIZE (TREE_TYPE (op))) { - error ("conversion of register to a different size"); + error ("conversion of register to a different size in %qs", + code_name); debug_generic_stmt (expr); return true; } @@ -3199,20 +3206,22 @@ verify_types_in_gimple_reference (tree expr, bool require_lvalue) expr = op; } + code_name = get_tree_code_name (TREE_CODE (expr)); + if (TREE_CODE (expr) == MEM_REF) { if (!is_gimple_mem_ref_addr (TREE_OPERAND (expr, 0)) || (TREE_CODE (TREE_OPERAND (expr, 0)) == ADDR_EXPR && verify_address (TREE_OPERAND (expr, 0), false))) { - error ("invalid address operand in MEM_REF"); + error ("invalid address operand in %qs", code_name); debug_generic_stmt (expr); return true; } if (!poly_int_tree_p (TREE_OPERAND (expr, 1)) || !POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (expr, 1)))) { - error ("invalid offset operand in MEM_REF"); + error ("invalid offset operand in %qs", code_name); debug_generic_stmt (expr); return true; } @@ -3224,21 +3233,21 @@ verify_types_in_gimple_reference (tree expr, bool require_lvalue) || (TREE_CODE (TMR_BASE (expr)) == ADDR_EXPR && verify_address (TMR_BASE (expr), false))) { - error ("invalid address operand in TARGET_MEM_REF"); + error ("invalid address operand in %qs", code_name); return true; } if (!TMR_OFFSET (expr) || !poly_int_tree_p (TMR_OFFSET (expr)) || !POINTER_TYPE_P (TREE_TYPE (TMR_OFFSET (expr)))) { - error ("invalid offset operand in TARGET_MEM_REF"); + error ("invalid offset operand in %qs", code_name); debug_generic_stmt (expr); return true; } } else if (TREE_CODE (expr) == INDIRECT_REF) { - error ("INDIRECT_REF in gimple IL"); + error ("%qs in gimple IL", code_name); debug_generic_stmt (expr); return true; } @@ -3345,7 +3354,7 @@ verify_gimple_call (gcall *stmt) && gimple_call_noreturn_p (stmt) && should_remove_lhs_p (lhs)) { - error ("LHS in noreturn call"); + error ("LHS in % call"); return true; } @@ -3536,6 +3545,8 @@ verify_gimple_assign_unary (gassign *stmt) return true; } + const char* const code_name = get_tree_code_name (rhs_code); + /* First handle conversions. */ switch (rhs_code) { @@ -3663,7 +3674,7 @@ verify_gimple_assign_unary (gassign *stmt) || maybe_ne (2 * TYPE_VECTOR_SUBPARTS (lhs_type), TYPE_VECTOR_SUBPARTS (rhs1_type))) { - error ("type mismatch in vector unpack expression"); + error ("type mismatch in %qs expression", code_name); debug_generic_expr (lhs_type); debug_generic_expr (rhs1_type); return true; @@ -3685,7 +3696,7 @@ verify_gimple_assign_unary (gassign *stmt) || TYPE_UNSIGNED (rhs1_type) || element_precision (lhs_type) != element_precision (rhs1_type)) { - error ("invalid types for ABSU_EXPR"); + error ("invalid types for %qs", code_name); debug_generic_expr (lhs_type); debug_generic_expr (rhs1_type); return true; @@ -3696,7 +3707,7 @@ verify_gimple_assign_unary (gassign *stmt) if (TREE_CODE (lhs_type) != VECTOR_TYPE || !useless_type_conversion_p (TREE_TYPE (lhs_type), rhs1_type)) { - error ("vec_duplicate should be from a scalar to a like vector"); + error ("%qs should be from a scalar to a like vector", code_name); debug_generic_expr (lhs_type); debug_generic_expr (rhs1_type); return true; @@ -3746,6 +3757,8 @@ verify_gimple_assign_binary (gassign *stmt) return true; } + const char* const code_name = get_tree_code_name (rhs_code); + /* First handle operations that involve different types. */ switch (rhs_code) { @@ -3757,7 +3770,7 @@ verify_gimple_assign_binary (gassign *stmt) || !(INTEGRAL_TYPE_P (rhs2_type) || SCALAR_FLOAT_TYPE_P (rhs2_type))) { - error ("type mismatch in complex expression"); + error ("type mismatch in %qs", code_name); debug_generic_expr (lhs_type); debug_generic_expr (rhs1_type); debug_generic_expr (rhs2_type); @@ -3786,7 +3799,7 @@ verify_gimple_assign_binary (gassign *stmt) && INTEGRAL_TYPE_P (TREE_TYPE (rhs2_type)))) || !useless_type_conversion_p (lhs_type, rhs1_type)) { - error ("type mismatch in shift expression"); + error ("type mismatch in %qs", code_name); debug_generic_expr (lhs_type); debug_generic_expr (rhs1_type); debug_generic_expr (rhs2_type); @@ -3803,7 +3816,7 @@ verify_gimple_assign_binary (gassign *stmt) || TREE_CODE (rhs2) != INTEGER_CST || (2 * TYPE_PRECISION (rhs1_type) > TYPE_PRECISION (lhs_type))) { - error ("type mismatch in widening vector shift expression"); + error ("type mismatch in %qs", code_name); debug_generic_expr (lhs_type); debug_generic_expr (rhs1_type); debug_generic_expr (rhs2_type); @@ -3824,7 +3837,7 @@ verify_gimple_assign_binary (gassign *stmt) || (2 * TYPE_PRECISION (TREE_TYPE (rhs1_type)) > TYPE_PRECISION (TREE_TYPE (lhs_type)))) { - error ("type mismatch in widening vector shift expression"); + error ("type mismatch in %qs", code_name); debug_generic_expr (lhs_type); debug_generic_expr (rhs1_type); debug_generic_expr (rhs2_type); @@ -3845,7 +3858,7 @@ verify_gimple_assign_binary (gassign *stmt) if (TREE_CODE (rhs1_type) != VECTOR_TYPE || TREE_CODE (rhs2_type) != VECTOR_TYPE) { - error ("invalid non-vector operands to vector valued plus"); + error ("invalid non-vector operands to %qs", code_name); return true; } lhs_etype = TREE_TYPE (lhs_type); @@ -3856,7 +3869,7 @@ verify_gimple_assign_binary (gassign *stmt) || POINTER_TYPE_P (rhs1_etype) || POINTER_TYPE_P (rhs2_etype)) { - error ("invalid (pointer) operands to plus/minus"); + error ("invalid (pointer) operands %qs", code_name); return true; } @@ -3870,7 +3883,7 @@ verify_gimple_assign_binary (gassign *stmt) || !useless_type_conversion_p (lhs_type, rhs1_type) || !ptrofftype_p (rhs2_type)) { - error ("type mismatch in pointer plus expression"); + error ("type mismatch in %qs", code_name); debug_generic_stmt (lhs_type); debug_generic_stmt (rhs1_type); debug_generic_stmt (rhs2_type); @@ -3891,7 +3904,7 @@ verify_gimple_assign_binary (gassign *stmt) || TYPE_UNSIGNED (lhs_type) || TYPE_PRECISION (lhs_type) != TYPE_PRECISION (rhs1_type)) { - error ("type mismatch in pointer diff expression"); + error ("type mismatch in %qs", code_name); debug_generic_stmt (lhs_type); debug_generic_stmt (rhs1_type); debug_generic_stmt (rhs2_type); @@ -3945,7 +3958,7 @@ verify_gimple_assign_binary (gassign *stmt) || maybe_lt (GET_MODE_SIZE (element_mode (rhs2_type)), 2 * GET_MODE_SIZE (element_mode (rhs1_type)))) { - error ("type mismatch in widening sum reduction"); + error ("type mismatch in %qs", code_name); debug_generic_expr (lhs_type); debug_generic_expr (rhs1_type); debug_generic_expr (rhs2_type); @@ -3965,7 +3978,7 @@ verify_gimple_assign_binary (gassign *stmt) || maybe_ne (GET_MODE_SIZE (element_mode (lhs_type)), 2 * GET_MODE_SIZE (element_mode (rhs1_type)))) { - error ("type mismatch in vector widening multiplication"); + error ("type mismatch in %qs", code_name); debug_generic_expr (lhs_type); debug_generic_expr (rhs1_type); debug_generic_expr (rhs2_type); @@ -4001,7 +4014,7 @@ verify_gimple_assign_binary (gassign *stmt) || maybe_ne (2 * TYPE_VECTOR_SUBPARTS (rhs1_type), TYPE_VECTOR_SUBPARTS (lhs_type))) { - error ("type mismatch in vector pack expression"); + error ("type mismatch in %qs", code_name); debug_generic_expr (lhs_type); debug_generic_expr (rhs1_type); debug_generic_expr (rhs2_type); @@ -4022,7 +4035,7 @@ verify_gimple_assign_binary (gassign *stmt) || maybe_ne (2 * TYPE_VECTOR_SUBPARTS (rhs1_type), TYPE_VECTOR_SUBPARTS (lhs_type))) { - error ("type mismatch in vector pack expression"); + error ("type mismatch in %qs", code_name); debug_generic_expr (lhs_type); debug_generic_expr (rhs1_type); debug_generic_expr (rhs2_type); @@ -4054,7 +4067,7 @@ verify_gimple_assign_binary (gassign *stmt) case VEC_SERIES_EXPR: if (!useless_type_conversion_p (rhs1_type, rhs2_type)) { - error ("type mismatch in series expression"); + error ("type mismatch in %qs", code_name); debug_generic_expr (rhs1_type); debug_generic_expr (rhs2_type); return true; @@ -4062,7 +4075,7 @@ verify_gimple_assign_binary (gassign *stmt) if (TREE_CODE (lhs_type) != VECTOR_TYPE || !useless_type_conversion_p (TREE_TYPE (lhs_type), rhs1_type)) { - error ("vector type expected in series expression"); + error ("vector type expected in %qs", code_name); debug_generic_expr (lhs_type); return true; } @@ -4116,6 +4129,8 @@ verify_gimple_assign_ternary (gassign *stmt) return true; } + const char* const code_name = get_tree_code_name (rhs_code); + /* First handle operations that involve different types. */ switch (rhs_code) { @@ -4128,7 +4143,7 @@ verify_gimple_assign_ternary (gassign *stmt) || 2 * TYPE_PRECISION (rhs1_type) > TYPE_PRECISION (lhs_type) || TYPE_PRECISION (rhs1_type) != TYPE_PRECISION (rhs2_type)) { - error ("type mismatch in widening multiply-accumulate expression"); + error ("type mismatch in %qs", code_name); debug_generic_expr (lhs_type); debug_generic_expr (rhs1_type); debug_generic_expr (rhs2_type); @@ -4142,9 +4157,9 @@ verify_gimple_assign_ternary (gassign *stmt) || maybe_ne (TYPE_VECTOR_SUBPARTS (rhs1_type), TYPE_VECTOR_SUBPARTS (lhs_type))) { - error ("the first argument of a VEC_COND_EXPR must be of a " + error ("the first argument of a %qs must be of a " "boolean vector type of the same number of elements " - "as the result"); + "as the result", code_name); debug_generic_expr (lhs_type); debug_generic_expr (rhs1_type); return true; @@ -4160,7 +4175,7 @@ verify_gimple_assign_ternary (gassign *stmt) if (!useless_type_conversion_p (lhs_type, rhs2_type) || !useless_type_conversion_p (lhs_type, rhs3_type)) { - error ("type mismatch in conditional expression"); + error ("type mismatch in %qs", code_name); debug_generic_expr (lhs_type); debug_generic_expr (rhs2_type); debug_generic_expr (rhs3_type); @@ -4172,7 +4187,7 @@ verify_gimple_assign_ternary (gassign *stmt) if (!useless_type_conversion_p (lhs_type, rhs1_type) || !useless_type_conversion_p (lhs_type, rhs2_type)) { - error ("type mismatch in vector permute expression"); + error ("type mismatch in %qs", code_name); debug_generic_expr (lhs_type); debug_generic_expr (rhs1_type); debug_generic_expr (rhs2_type); @@ -4184,7 +4199,7 @@ verify_gimple_assign_ternary (gassign *stmt) || TREE_CODE (rhs2_type) != VECTOR_TYPE || TREE_CODE (rhs3_type) != VECTOR_TYPE) { - error ("vector types expected in vector permute expression"); + error ("vector types expected in %qs", code_name); debug_generic_expr (lhs_type); debug_generic_expr (rhs1_type); debug_generic_expr (rhs2_type); @@ -4199,8 +4214,8 @@ verify_gimple_assign_ternary (gassign *stmt) || maybe_ne (TYPE_VECTOR_SUBPARTS (rhs3_type), TYPE_VECTOR_SUBPARTS (lhs_type))) { - error ("vectors with different element number found " - "in vector permute expression"); + error ("vectors with different element number found in %qs", + code_name); debug_generic_expr (lhs_type); debug_generic_expr (rhs1_type); debug_generic_expr (rhs2_type); @@ -4215,7 +4230,7 @@ verify_gimple_assign_ternary (gassign *stmt) != GET_MODE_BITSIZE (SCALAR_TYPE_MODE (TREE_TYPE (rhs1_type)))))) { - error ("invalid mask type in vector permute expression"); + error ("invalid mask type in %qs", code_name); debug_generic_expr (lhs_type); debug_generic_expr (rhs1_type); debug_generic_expr (rhs2_type); @@ -4231,7 +4246,7 @@ verify_gimple_assign_ternary (gassign *stmt) || 2 * GET_MODE_UNIT_BITSIZE (TYPE_MODE (TREE_TYPE (rhs1_type))) > GET_MODE_UNIT_BITSIZE (TYPE_MODE (TREE_TYPE (lhs_type)))) { - error ("type mismatch in sad expression"); + error ("type mismatch in %qs", code_name); debug_generic_expr (lhs_type); debug_generic_expr (rhs1_type); debug_generic_expr (rhs2_type); @@ -4243,7 +4258,7 @@ verify_gimple_assign_ternary (gassign *stmt) || TREE_CODE (rhs2_type) != VECTOR_TYPE || TREE_CODE (rhs3_type) != VECTOR_TYPE) { - error ("vector types expected in sad expression"); + error ("vector types expected in %qs", code_name); debug_generic_expr (lhs_type); debug_generic_expr (rhs1_type); debug_generic_expr (rhs2_type); @@ -4256,7 +4271,7 @@ verify_gimple_assign_ternary (gassign *stmt) case BIT_INSERT_EXPR: if (! useless_type_conversion_p (lhs_type, rhs1_type)) { - error ("type mismatch in BIT_INSERT_EXPR"); + error ("type mismatch in %qs", code_name); debug_generic_expr (lhs_type); debug_generic_expr (rhs1_type); return true; @@ -4266,7 +4281,7 @@ verify_gimple_assign_ternary (gassign *stmt) || (VECTOR_TYPE_P (rhs1_type) && types_compatible_p (TREE_TYPE (rhs1_type), rhs2_type)))) { - error ("not allowed type combination in BIT_INSERT_EXPR"); + error ("not allowed type combination in %qs", code_name); debug_generic_expr (rhs1_type); debug_generic_expr (rhs2_type); return true; @@ -4275,13 +4290,13 @@ verify_gimple_assign_ternary (gassign *stmt) || ! types_compatible_p (bitsizetype, TREE_TYPE (rhs3)) || ! tree_fits_uhwi_p (TYPE_SIZE (rhs2_type))) { - error ("invalid position or size in BIT_INSERT_EXPR"); + error ("invalid position or size in %qs", code_name); return true; } if (INTEGRAL_TYPE_P (rhs1_type) && !type_has_mode_precision_p (rhs1_type)) { - error ("BIT_INSERT_EXPR into non-mode-precision operand"); + error ("%qs into non-mode-precision operand", code_name); return true; } if (INTEGRAL_TYPE_P (rhs1_type)) @@ -4291,7 +4306,7 @@ verify_gimple_assign_ternary (gassign *stmt) || (bitpos + TYPE_PRECISION (rhs2_type) > TYPE_PRECISION (rhs1_type))) { - error ("insertion out of range in BIT_INSERT_EXPR"); + error ("insertion out of range in %qs", code_name); return true; } } @@ -4301,7 +4316,7 @@ verify_gimple_assign_ternary (gassign *stmt) unsigned HOST_WIDE_INT bitsize = tree_to_uhwi (TYPE_SIZE (rhs2_type)); if (bitpos % bitsize != 0) { - error ("vector insertion not at element boundary"); + error ("%qs not at element boundary", code_name); return true; } } @@ -4320,7 +4335,7 @@ verify_gimple_assign_ternary (gassign *stmt) || maybe_lt (GET_MODE_SIZE (element_mode (rhs3_type)), 2 * GET_MODE_SIZE (element_mode (rhs1_type)))) { - error ("type mismatch in dot product reduction"); + error ("type mismatch in %qs", code_name); debug_generic_expr (lhs_type); debug_generic_expr (rhs1_type); debug_generic_expr (rhs2_type); @@ -4352,9 +4367,11 @@ verify_gimple_assign_single (gassign *stmt) tree rhs1_type = TREE_TYPE (rhs1); bool res = false; + const char* const code_name = get_tree_code_name (rhs_code); + if (!useless_type_conversion_p (lhs_type, rhs1_type)) { - error ("non-trivial conversion at assignment"); + error ("non-trivial conversion in %qs", code_name); debug_generic_expr (lhs_type); debug_generic_expr (rhs1_type); return true; @@ -4363,7 +4380,8 @@ verify_gimple_assign_single (gassign *stmt) if (gimple_clobber_p (stmt) && !(DECL_P (lhs) || TREE_CODE (lhs) == MEM_REF)) { - error ("non-decl/MEM_REF LHS in clobber statement"); + error ("%qs LHS in clobber statement", + get_tree_code_name (TREE_CODE (lhs))); debug_generic_expr (lhs); return true; } @@ -4381,7 +4399,7 @@ verify_gimple_assign_single (gassign *stmt) tree op = TREE_OPERAND (rhs1, 0); if (!is_gimple_addressable (op)) { - error ("invalid operand in unary expression"); + error ("invalid operand in %qs", code_name); return true; } @@ -4395,7 +4413,7 @@ verify_gimple_assign_single (gassign *stmt) && !one_pointer_to_useless_type_conversion_p (TREE_TYPE (rhs1), TREE_TYPE (op))) { - error ("type mismatch in address expression"); + error ("type mismatch in %qs", code_name); debug_generic_stmt (TREE_TYPE (rhs1)); debug_generic_stmt (TREE_TYPE (op)); return true; @@ -4407,7 +4425,7 @@ verify_gimple_assign_single (gassign *stmt) /* tcc_reference */ case INDIRECT_REF: - error ("INDIRECT_REF in gimple IL"); + error ("%qs in gimple IL", code_name); return true; case COMPONENT_REF: @@ -4422,7 +4440,7 @@ verify_gimple_assign_single (gassign *stmt) if (!is_gimple_reg (lhs) && is_gimple_reg_type (TREE_TYPE (lhs))) { - error ("invalid rhs for gimple memory store"); + error ("invalid RHS for gimple memory store: %qs", code_name); debug_generic_stmt (lhs); debug_generic_stmt (rhs1); return true; @@ -4448,7 +4466,7 @@ verify_gimple_assign_single (gassign *stmt) && !is_gimple_reg (rhs1) && is_gimple_reg_type (TREE_TYPE (lhs))) { - error ("invalid rhs for gimple memory store"); + error ("invalid RHS for gimple memory store: %qs", code_name); debug_generic_stmt (lhs); debug_generic_stmt (rhs1); return true; @@ -4482,8 +4500,8 @@ verify_gimple_assign_single (gassign *stmt) if (!useless_type_conversion_p (TREE_TYPE (rhs1_type), TREE_TYPE (elt_t))) { - error ("incorrect type of vector CONSTRUCTOR" - " elements"); + error ("incorrect type of vector %qs elements", + code_name); debug_generic_stmt (rhs1); return true; } @@ -4491,8 +4509,8 @@ verify_gimple_assign_single (gassign *stmt) * TYPE_VECTOR_SUBPARTS (elt_t), TYPE_VECTOR_SUBPARTS (rhs1_type))) { - error ("incorrect number of vector CONSTRUCTOR" - " elements"); + error ("incorrect number of vector %qs elements", + code_name); debug_generic_stmt (rhs1); return true; } @@ -4500,14 +4518,16 @@ verify_gimple_assign_single (gassign *stmt) else if (!useless_type_conversion_p (TREE_TYPE (rhs1_type), elt_t)) { - error ("incorrect type of vector CONSTRUCTOR elements"); + error ("incorrect type of vector %qs elements", + code_name); debug_generic_stmt (rhs1); return true; } else if (maybe_gt (CONSTRUCTOR_NELTS (rhs1), TYPE_VECTOR_SUBPARTS (rhs1_type))) { - error ("incorrect number of vector CONSTRUCTOR elements"); + error ("incorrect number of vector %qs elements", + code_name); debug_generic_stmt (rhs1); return true; } @@ -4523,13 +4543,15 @@ verify_gimple_assign_single (gassign *stmt) || TREE_CODE (elt_i) != INTEGER_CST || compare_tree_int (elt_i, i) != 0)) { - error ("vector CONSTRUCTOR with non-NULL element index"); + error ("vector %qs with non-NULL element index", + code_name); debug_generic_stmt (rhs1); return true; } if (!is_gimple_val (elt_v)) { - error ("vector CONSTRUCTOR element is not a GIMPLE value"); + error ("vector %qs element is not a GIMPLE value", + code_name); debug_generic_stmt (rhs1); return true; } @@ -4537,7 +4559,7 @@ verify_gimple_assign_single (gassign *stmt) } else if (CONSTRUCTOR_NELTS (rhs1) != 0) { - error ("non-vector CONSTRUCTOR with elements"); + error ("non-vector %qs with elements", code_name); debug_generic_stmt (rhs1); return true; } @@ -4548,7 +4570,7 @@ verify_gimple_assign_single (gassign *stmt) rhs1 = fold (ASSERT_EXPR_COND (rhs1)); if (rhs1 == boolean_false_node) { - error ("ASSERT_EXPR with an always-false condition"); + error ("%qs with an always-false condition", code_name); debug_generic_stmt (rhs1); return true; } @@ -4695,7 +4717,7 @@ verify_gimple_switch (gswitch *stmt) if (CASE_CHAIN (elt)) { - error ("invalid CASE_CHAIN"); + error ("invalid %"); debug_generic_expr (elt); return true; } @@ -4789,7 +4811,7 @@ verify_gimple_label (glabel *stmt) && (uid == -1 || (*label_to_block_map_for_fn (cfun))[uid] != gimple_bb (stmt))) { - error ("incorrect entry in label_to_block_map"); + error ("incorrect entry in %"); err |= true; } @@ -4906,7 +4928,7 @@ verify_gimple_phi (gphi *phi) if (!phi_result) { - error ("invalid PHI result"); + error ("invalid % result"); return true; } @@ -4915,7 +4937,7 @@ verify_gimple_phi (gphi *phi) || (virtual_p && SSA_NAME_VAR (phi_result) != gimple_vop (cfun))) { - error ("invalid PHI result"); + error ("invalid % result"); err = true; } @@ -4925,7 +4947,7 @@ verify_gimple_phi (gphi *phi) if (!t) { - error ("missing PHI def"); + error ("missing % def"); err |= true; continue; } @@ -4939,14 +4961,14 @@ verify_gimple_phi (gphi *phi) || (!virtual_p && !is_gimple_val (t))) { - error ("invalid PHI argument"); + error ("invalid % argument"); debug_generic_expr (t); err |= true; } #ifdef ENABLE_TYPES_CHECKING if (!useless_type_conversion_p (TREE_TYPE (phi_result), TREE_TYPE (t))) { - error ("incompatible types in PHI argument %u", i); + error ("incompatible types in % argument %u", i); debug_generic_stmt (TREE_TYPE (phi_result)); debug_generic_stmt (TREE_TYPE (t)); err |= true; @@ -5044,7 +5066,7 @@ verify_gimple_in_seq (gimple_seq stmts) { timevar_push (TV_TREE_STMT_VERIFY); if (verify_gimple_in_seq_2 (stmts)) - internal_error ("verify_gimple failed"); + internal_error ("% failed"); timevar_pop (TV_TREE_STMT_VERIFY); } @@ -5101,7 +5123,7 @@ verify_eh_throw_stmt_node (gimple *const &stmt, const int &, { if (!visited->contains (stmt)) { - error ("dead STMT in EH table"); + error ("dead statement in EH table"); debug_gimple_stmt (stmt); eh_error_found = true; } @@ -5225,6 +5247,14 @@ collect_subblocks (hash_set *blocks, tree block) } } +/* Disable warnings about missing quoting in GCC diagnostics for + the verification errors. Their format strings don't follow + GCC diagnostic conventions and trigger an ICE in the end. */ +#if __GNUC__ >= 10 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wformat-diag" +#endif + /* Verify the GIMPLE statements in the CFG of FN. */ DEBUG_FUNCTION void @@ -5702,6 +5732,9 @@ gimple_verify_flow_info (void) return err; } +#if __GNUC__ >= 10 +# pragma GCC diagnostic pop +#endif /* Updates phi nodes after creating a forwarder block joined by edge FALLTHRU. */ @@ -9404,13 +9437,13 @@ do_warn_unused_result (gimple_seq seq) if (fdecl) warning_at (loc, OPT_Wunused_result, - "ignoring return value of %qD, " - "declared with attribute warn_unused_result", + "ignoring return value of %qD " + "declared with attribute %", fdecl); else warning_at (loc, OPT_Wunused_result, "ignoring return value of function " - "declared with attribute warn_unused_result"); + "declared with attribute %"); } break; diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c index c8063486f2d..f7a1ded80ab 100644 --- a/gcc/tree-eh.c +++ b/gcc/tree-eh.c @@ -4728,6 +4728,14 @@ make_pass_cleanup_eh (gcc::context *ctxt) return new pass_cleanup_eh (ctxt); } +/* Disable warnings about missing quoting in GCC diagnostics for + the verification errors. Their format strings don't follow + GCC diagnostic conventions and trigger an ICE in the end. */ +#if __GNUC__ >= 10 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wformat-diag" +#endif + /* Verify that BB containing STMT as the last statement, has precisely the edge that make_eh_edges would create. */ @@ -4874,3 +4882,7 @@ verify_eh_dispatch_edge (geh_dispatch *stmt) return false; } + +#if __GNUC__ >= 10 +# pragma GCC diagnostic pop +#endif diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 35c005ee989..7598674f39c 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -4615,7 +4615,7 @@ expand_call_inline (basic_block bb, gimple *stmt, copy_body_data *id) /* PR 20090218-1_0.c. Body can be provided by another module. */ && (reason != CIF_BODY_NOT_AVAILABLE || !flag_generate_lto)) { - error ("inlining failed in call to always_inline %q+F: %s", fn, + error ("inlining failed in call to % %q+F: %s", fn, cgraph_inline_failed_string (reason)); if (gimple_location (stmt) != UNKNOWN_LOCATION) inform (gimple_location (stmt), "called from here"); diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c index 061521d20d5..254836f5eb0 100644 --- a/gcc/tree-into-ssa.c +++ b/gcc/tree-into-ssa.c @@ -3304,7 +3304,7 @@ update_ssa (unsigned update_flags) if (SSA_NAME_IN_FREE_LIST (use)) { - error ("statement uses released SSA name:"); + error ("statement uses released SSA name"); debug_gimple_stmt (stmt); fprintf (stderr, "The use of "); print_generic_expr (stderr, use); diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c index ae0a6c12072..56895478b41 100644 --- a/gcc/tree-pretty-print.c +++ b/gcc/tree-pretty-print.c @@ -35,6 +35,13 @@ along with GCC; see the file COPYING3. If not see #include "gomp-constants.h" #include "gimple.h" +/* Disable warnings about quoting issues in the pp_xxx calls below + that (intentionally) don't follow GCC diagnostic conventions. */ +#if __GNUC__ >= 10 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wformat-diag" +#endif + /* Local functions, macros and variables. */ static const char *op_symbol (const_tree); static void pretty_print_string (pretty_printer *, const char*, unsigned); @@ -4210,3 +4217,7 @@ pp_double_int (pretty_printer *pp, double_int d, bool uns) pp_string (pp, pp_buffer (pp)->digit_buffer); } } + +#if __GNUC__ >= 10 +# pragma GCC diagnostic pop +#endif diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 489f6dc1501..e145dcd32df 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -627,6 +627,14 @@ release_defs_bitset (bitmap toremove) } +/* Disable warnings about missing quoting in GCC diagnostics for + the verification errors. Their format strings don't follow + GCC diagnostic conventions and trigger an ICE in the end. */ +#if __GNUC__ >= 9 // FIXME: change me to 10 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wformat-diag" +#endif + /* Verify virtual SSA form. */ bool @@ -1193,6 +1201,9 @@ err: internal_error ("verify_ssa failed"); } +#if __GNUC__ >= 10 +# pragma GCC diagnostic pop +#endif /* Initialize global DFA and SSA structures. */ diff --git a/gcc/tree.c b/gcc/tree.c index 73102c4e75b..ecf98af964d 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -10009,8 +10009,9 @@ void omp_clause_check_failed (const_tree node, const char *file, int line, const char *function, enum omp_clause_code code) { - internal_error ("tree check: expected omp_clause %s, have %s in %s, at %s:%d", - omp_clause_code_name[code], get_tree_code_name (TREE_CODE (node)), + internal_error ("tree check: expected %, have %qk " + "in %s, at %s:%d", + omp_clause_code_name[code], TREE_CODE (node), function, trim_filename (file), line); } @@ -10083,7 +10084,8 @@ tree_int_cst_elt_check_failed (int idx, int len, const char *file, int line, const char *function) { internal_error - ("tree check: accessed elt %d of tree_int_cst with %d elts in %s, at %s:%d", + ("tree check: accessed elt %d of % with %d elts in %s, " + "at %s:%d", idx + 1, len, function, trim_filename (file), line); } @@ -10095,7 +10097,7 @@ tree_vec_elt_check_failed (int idx, int len, const char *file, int line, const char *function) { internal_error - ("tree check: accessed elt %d of tree_vec with %d elts in %s, at %s:%d", + ("tree check: accessed elt %d of % with %d elts in %s, at %s:%d", idx + 1, len, function, trim_filename (file), line); } @@ -10121,7 +10123,7 @@ omp_clause_operand_check_failed (int idx, const_tree t, const char *file, int line, const char *function) { internal_error - ("tree check: accessed operand %d of omp_clause %s with %d operands " + ("tree check: accessed operand %d of % with %d operands " "in %s, at %s:%d", idx + 1, omp_clause_code_name[OMP_CLAUSE_CODE (t)], omp_clause_num_ops [OMP_CLAUSE_CODE (t)], function, trim_filename (file), line); @@ -13853,11 +13855,11 @@ verify_type_variant (const_tree t, tree tv) { gcc_assert (!operand_equal_p (TYPE_SIZE_UNIT (t), TYPE_SIZE_UNIT (tv), 0)); - error ("type variant has different TYPE_SIZE_UNIT"); + error ("type variant has different %"); debug_tree (tv); - error ("type variant%'s TYPE_SIZE_UNIT"); + error ("type variant%'s %"); debug_tree (TYPE_SIZE_UNIT (tv)); - error ("type%'s TYPE_SIZE_UNIT"); + error ("type%'s %"); debug_tree (TYPE_SIZE_UNIT (t)); return false; } @@ -13877,7 +13879,7 @@ verify_type_variant (const_tree t, tree tv) verify_variant_match (TYPE_STRING_FLAG); if (TYPE_ALIAS_SET_KNOWN_P (t)) { - error ("type variant with TYPE_ALIAS_SET_KNOWN_P"); + error ("type variant with %"); debug_tree (tv); return false; } @@ -13890,7 +13892,7 @@ verify_type_variant (const_tree t, tree tv) && (in_lto_p || !TYPE_VFIELD (tv) || TREE_CODE (TYPE_VFIELD (tv)) != TREE_LIST)) { - error ("type variant has different TYPE_VFIELD"); + error ("type variant has different %"); debug_tree (tv); return false; } @@ -13926,11 +13928,11 @@ verify_type_variant (const_tree t, tree tv) at LTO time only. */ && (in_lto_p && odr_type_p (t))) { - error ("type variant has different TYPE_BINFO"); + error ("type variant has different %"); debug_tree (tv); - error ("type variant%'s TYPE_BINFO"); + error ("type variant%'s %"); debug_tree (TYPE_BINFO (tv)); - error ("type%'s TYPE_BINFO"); + error ("type%'s %"); debug_tree (TYPE_BINFO (t)); return false; } @@ -13969,7 +13971,7 @@ verify_type_variant (const_tree t, tree tv) break; if (f1 || f2) { - error ("type variant has different TYPE_FIELDS"); + error ("type variant has different %"); debug_tree (tv); error ("first mismatch is field"); debug_tree (f1); @@ -13990,11 +13992,11 @@ verify_type_variant (const_tree t, tree tv) || TYPE_MAIN_VARIANT (TREE_TYPE (t)) != TYPE_MAIN_VARIANT (TREE_TYPE (tv)))) { - error ("type variant has different TREE_TYPE"); + error ("type variant has different %"); debug_tree (tv); - error ("type variant%'s TREE_TYPE"); + error ("type variant%'s %"); debug_tree (TREE_TYPE (tv)); - error ("type%'s TREE_TYPE"); + error ("type%'s %"); debug_tree (TREE_TYPE (t)); return false; } @@ -14003,9 +14005,9 @@ verify_type_variant (const_tree t, tree tv) { error ("type is not compatible with its variant"); debug_tree (tv); - error ("type variant%'s TREE_TYPE"); + error ("type variant%'s %"); debug_tree (TREE_TYPE (tv)); - error ("type%'s TREE_TYPE"); + error ("type%'s %"); debug_tree (TREE_TYPE (t)); return false; } @@ -14304,12 +14306,12 @@ verify_type (const_tree t) tree mv = TYPE_MAIN_VARIANT (t); if (!mv) { - error ("Main variant is not defined"); + error ("main variant is not defined"); error_found = true; } else if (mv != TYPE_MAIN_VARIANT (mv)) { - error ("TYPE_MAIN_VARIANT has different TYPE_MAIN_VARIANT"); + error ("% has different %"); debug_tree (mv); error_found = true; } @@ -14321,7 +14323,7 @@ verify_type (const_tree t) ; else if (TYPE_CANONICAL (t) != ct) { - error ("TYPE_CANONICAL has different TYPE_CANONICAL"); + error ("% has different %"); debug_tree (ct); error_found = true; } @@ -14340,7 +14342,7 @@ verify_type (const_tree t) && !gimple_canonical_types_compatible_p (t, ct, false) && COMPLETE_TYPE_P (t)) { - error ("TYPE_CANONICAL is not compatible"); + error ("% is not compatible"); debug_tree (ct); error_found = true; } @@ -14348,13 +14350,13 @@ verify_type (const_tree t) if (COMPLETE_TYPE_P (t) && TYPE_CANONICAL (t) && TYPE_MODE (t) != TYPE_MODE (TYPE_CANONICAL (t))) { - error ("TYPE_MODE of TYPE_CANONICAL is not compatible"); + error ("% of % is not compatible"); debug_tree (ct); error_found = true; } if (TYPE_MAIN_VARIANT (t) == t && ct && TYPE_MAIN_VARIANT (ct) != ct) { - error ("TYPE_CANONICAL of main variant is not main variant"); + error ("% of main variant is not main variant"); debug_tree (ct); debug_tree (TYPE_MAIN_VARIANT (ct)); error_found = true; @@ -14370,7 +14372,7 @@ verify_type (const_tree t) && TREE_CODE (TYPE_VFIELD (t)) != FIELD_DECL && TREE_CODE (TYPE_VFIELD (t)) != TREE_LIST) { - error ("TYPE_VFIELD is not FIELD_DECL nor TREE_LIST"); + error ("% is not % nor %"); debug_tree (TYPE_VFIELD (t)); error_found = true; } @@ -14380,7 +14382,7 @@ verify_type (const_tree t) if (TYPE_NEXT_PTR_TO (t) && TREE_CODE (TYPE_NEXT_PTR_TO (t)) != POINTER_TYPE) { - error ("TYPE_NEXT_PTR_TO is not POINTER_TYPE"); + error ("% is not %"); debug_tree (TYPE_NEXT_PTR_TO (t)); error_found = true; } @@ -14390,7 +14392,7 @@ verify_type (const_tree t) if (TYPE_NEXT_REF_TO (t) && TREE_CODE (TYPE_NEXT_REF_TO (t)) != REFERENCE_TYPE) { - error ("TYPE_NEXT_REF_TO is not REFERENCE_TYPE"); + error ("% is not %"); debug_tree (TYPE_NEXT_REF_TO (t)); error_found = true; } @@ -14411,13 +14413,13 @@ verify_type (const_tree t) ; else if (TREE_CODE (TYPE_BINFO (t)) != TREE_BINFO) { - error ("TYPE_BINFO is not TREE_BINFO"); + error ("% is not %"); debug_tree (TYPE_BINFO (t)); error_found = true; } else if (TREE_TYPE (TYPE_BINFO (t)) != TYPE_MAIN_VARIANT (t)) { - error ("TYPE_BINFO type is not TYPE_MAIN_VARIANT"); + error ("% type is not %"); debug_tree (TREE_TYPE (TYPE_BINFO (t))); error_found = true; } @@ -14428,7 +14430,7 @@ verify_type (const_tree t) && TREE_CODE (TYPE_METHOD_BASETYPE (t)) != RECORD_TYPE && TREE_CODE (TYPE_METHOD_BASETYPE (t)) != UNION_TYPE) { - error ("TYPE_METHOD_BASETYPE is not record nor union"); + error ("% is not record nor union"); debug_tree (TYPE_METHOD_BASETYPE (t)); error_found = true; } @@ -14439,7 +14441,7 @@ verify_type (const_tree t) && TREE_CODE (TYPE_OFFSET_BASETYPE (t)) != RECORD_TYPE && TREE_CODE (TYPE_OFFSET_BASETYPE (t)) != UNION_TYPE) { - error ("TYPE_OFFSET_BASETYPE is not record nor union"); + error ("% is not record nor union"); debug_tree (TYPE_OFFSET_BASETYPE (t)); error_found = true; } @@ -14457,21 +14459,21 @@ verify_type (const_tree t) if (TYPE_ARRAY_MAX_SIZE (t) && TREE_CODE (TYPE_ARRAY_MAX_SIZE (t)) != INTEGER_CST) { - error ("TYPE_ARRAY_MAX_SIZE not INTEGER_CST"); + error ("% not %"); debug_tree (TYPE_ARRAY_MAX_SIZE (t)); error_found = true; } } else if (TYPE_MAX_VALUE_RAW (t)) { - error ("TYPE_MAX_VALUE_RAW non-NULL"); + error ("% non-NULL"); debug_tree (TYPE_MAX_VALUE_RAW (t)); error_found = true; } if (TYPE_LANG_SLOT_1 (t) && in_lto_p) { - error ("TYPE_LANG_SLOT_1 (binfo) field is non-NULL"); + error ("% field is non-NULL"); debug_tree (TYPE_LANG_SLOT_1 (t)); error_found = true; } @@ -14487,7 +14489,7 @@ verify_type (const_tree t) CONST_DECL of ENUMERAL TYPE. */ if (TREE_CODE (value) != INTEGER_CST && TREE_CODE (value) != CONST_DECL) { - error ("Enum value is not CONST_DECL or INTEGER_CST"); + error ("enum value is not % or %"); debug_tree (value); debug_tree (name); error_found = true; @@ -14495,14 +14497,15 @@ verify_type (const_tree t) if (TREE_CODE (TREE_TYPE (value)) != INTEGER_TYPE && !useless_type_conversion_p (const_cast (t), TREE_TYPE (value))) { - error ("Enum value type is not INTEGER_TYPE nor convertible to the enum"); + error ("enum value type is not % nor convertible " + "to the enum"); debug_tree (value); debug_tree (name); error_found = true; } if (TREE_CODE (name) != IDENTIFIER_NODE) { - error ("Enum value name is not IDENTIFIER_NODE"); + error ("enum value name is not %"); debug_tree (value); debug_tree (name); error_found = true; @@ -14512,7 +14515,7 @@ verify_type (const_tree t) { if (TYPE_DOMAIN (t) && TREE_CODE (TYPE_DOMAIN (t)) != INTEGER_TYPE) { - error ("Array TYPE_DOMAIN is not integer type"); + error ("array % is not integer type"); debug_tree (TYPE_DOMAIN (t)); error_found = true; } @@ -14521,7 +14524,7 @@ verify_type (const_tree t) { if (TYPE_FIELDS (t) && !COMPLETE_TYPE_P (t) && in_lto_p) { - error ("TYPE_FIELDS defined in incomplete type"); + error ("% defined in incomplete type"); error_found = true; } for (tree fld = TYPE_FIELDS (t); fld; fld = TREE_CHAIN (fld)) @@ -14543,7 +14546,7 @@ verify_type (const_tree t) ; else { - error ("Wrong tree in TYPE_FIELDS list"); + error ("wrong tree in % list"); debug_tree (fld); error_found = true; } @@ -14558,13 +14561,14 @@ verify_type (const_tree t) { if (TYPE_CACHED_VALUES_P (t) != (TYPE_CACHED_VALUES (t) != NULL)) { - error ("TYPE_CACHED_VALUES_P is %i while TYPE_CACHED_VALUES is %p", + error ("% is %i while % " + "is %p", TYPE_CACHED_VALUES_P (t), (void *)TYPE_CACHED_VALUES (t)); error_found = true; } else if (TYPE_CACHED_VALUES_P (t) && TREE_CODE (TYPE_CACHED_VALUES (t)) != TREE_VEC) { - error ("TYPE_CACHED_VALUES is not TREE_VEC"); + error ("% is not %"); debug_tree (TYPE_CACHED_VALUES (t)); error_found = true; } @@ -14577,7 +14581,7 @@ verify_type (const_tree t) if (TREE_VEC_ELT (TYPE_CACHED_VALUES (t), i) && TREE_TYPE (TREE_VEC_ELT (TYPE_CACHED_VALUES (t), i)) != t) { - error ("wrong TYPE_CACHED_VALUES entry"); + error ("wrong % entry"); debug_tree (TREE_VEC_ELT (TYPE_CACHED_VALUES (t), i)); error_found = true; break; @@ -14590,20 +14594,20 @@ verify_type (const_tree t) /* C++ FE uses TREE_PURPOSE to store initial values. */ if (TREE_PURPOSE (l) && in_lto_p) { - error ("TREE_PURPOSE is non-NULL in TYPE_ARG_TYPES list"); + error ("% is non-NULL in % list"); debug_tree (l); error_found = true; } if (!TYPE_P (TREE_VALUE (l))) { - error ("Wrong entry in TYPE_ARG_TYPES list"); + error ("wrong entry in % list"); debug_tree (l); error_found = true; } } else if (!is_lang_specific (t) && TYPE_VALUES_RAW (t)) { - error ("TYPE_VALUES_RAW field is non-NULL"); + error ("% field is non-NULL"); debug_tree (TYPE_VALUES_RAW (t)); error_found = true; } @@ -14615,13 +14619,13 @@ verify_type (const_tree t) && TREE_CODE (t) != POINTER_TYPE && TYPE_CACHED_VALUES_P (t)) { - error ("TYPE_CACHED_VALUES_P is set while it should not"); + error ("% is set while it should not be"); error_found = true; } if (TYPE_STRING_FLAG (t) && TREE_CODE (t) != ARRAY_TYPE && TREE_CODE (t) != INTEGER_TYPE) { - error ("TYPE_STRING_FLAG is set on wrong type code"); + error ("% is set on wrong type code"); error_found = true; } @@ -14631,14 +14635,14 @@ verify_type (const_tree t) if (TREE_CODE (t) == METHOD_TYPE && TYPE_MAIN_VARIANT (TYPE_METHOD_BASETYPE (t)) != TYPE_METHOD_BASETYPE (t)) { - error ("TYPE_METHOD_BASETYPE is not main variant"); + error ("% is not main variant"); error_found = true; } if (error_found) { debug_tree (const_cast (t)); - internal_error ("verify_type failed"); + internal_error ("%qs failed", __func__); } } diff --git a/gcc/value-prof.c b/gcc/value-prof.c index 5013956cf86..d34d2ab7685 100644 --- a/gcc/value-prof.c +++ b/gcc/value-prof.c @@ -535,7 +535,7 @@ verify_histograms (void) { if (hist->hvalue.stmt != stmt) { - error ("Histogram value statement does not correspond to " + error ("histogram value statement does not correspond to " "the statement it is associated with"); debug_gimple_stmt (stmt); dump_histogram_value (stderr, hist); @@ -547,7 +547,7 @@ verify_histograms (void) if (VALUE_HISTOGRAMS (cfun)) htab_traverse (VALUE_HISTOGRAMS (cfun), visit_hist, &visited_hists); if (error_found) - internal_error ("verify_histograms failed"); + internal_error ("%qs failed", __func__); } /* Helper function for verify_histograms. For each histogram reachable via htab diff --git a/gcc/varasm.c b/gcc/varasm.c index cb43248ec49..9397152dbce 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -1878,7 +1878,9 @@ assemble_start_function (tree decl, const char *fnname) if (patch_area_entry > patch_area_size) { if (patch_area_size > 0) - warning (OPT_Wattributes, "patchable function entry > size"); + warning (OPT_Wattributes, + "patchable function entry %wu exceeds size %wu", + patch_area_entry, patch_area_size); patch_area_entry = 0; } From patchwork Tue May 14 21:32:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Sebor X-Patchwork-Id: 1099750 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-500698-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="E1tnqYCS"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="nYlKP6v6"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 453WF94cB1z9sDn for ; Wed, 15 May 2019 07:35:25 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=GppQulpoodN7wbiRFxp+mNO6b0LmnjELO+dePAnYJ8cGQ2ree4 kxa/fRbA0436he0Z7gB4tKgI5lqCUy5fVUFBp9GEyhxWW2/RR/1IHsiI2R18Z25K yc8Hyf3KyUmjnq7RTExTbuLq6p89vMHHa+3UlyMP/IVwzPSDIJ2Q1i5Co= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=kA/g3JY/tfLwD7/NF7pvCfW7Nfs=; b=E1tnqYCSSLCkqdD+urjy 7jr0ThnTzyr5Yeza7Eq+BQ6jgJATb6kb0/H9o+KhDErHbouw4/veb6AFc9ZQ5w1M yAeX1chaMVWWwcnMzuqEDq5fbJozuFqP8vHH/HH8UXDIDpnliF0KoILjVaJhzrtH KFsOyUTTM+j3XMwkkMkFwH8= Received: (qmail 45028 invoked by alias); 14 May 2019 21:33:27 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 44910 invoked by uid 89); 14 May 2019 21:33:26 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.4 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=Messages, xc, Origin X-HELO: mail-qk1-f172.google.com Received: from mail-qk1-f172.google.com (HELO mail-qk1-f172.google.com) (209.85.222.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 14 May 2019 21:32:59 +0000 Received: by mail-qk1-f172.google.com with SMTP id a132so184487qkb.13 for ; Tue, 14 May 2019 14:32:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:date:user-agent:mime-version :content-language; bh=9wZnu+F4u68qyZMNc19dlcUw2PMoSliDi5NleKGvp+8=; b=nYlKP6v6fus0W/95DNAR40gM5cUfWBNRzDvUv2biruqUjZbL21hF9/CWNnOoSyvXhd PDe64KOqk1O3BOxlJi03Rv7CDHVG61K9rzSZDaxcXjAvLqukfUnr+WGzGgzk6V4nPgbG hWlBsNzRO2P/o8HS0lPg53MWUsB7iNYvxJI2Cu0tilvZWoG+8uf1C3l0S6Go1EbUN2Ve oWu5/EsjP9UyGsukd7lG9MrYkMMYm3LBszT2xYKWmr/tazJ9h2ZJWeRV1inkwqTKRQ6C 1Fx6oGtvDhgx7HiTGXgF42arXR2wIEAOx7PGQNdqDV4j2uCwVq7lF6l+Dvz3DRmEbqhj 6izA== Received: from [192.168.0.41] (97-118-125-210.hlrn.qwest.net. [97.118.125.210]) by smtp.gmail.com with ESMTPSA id u9sm55822qtg.91.2019.05.14.14.32.55 for (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Tue, 14 May 2019 14:32:56 -0700 (PDT) To: gcc-patches From: Martin Sebor Subject: [PATCH 9/12] adjust tests to quoting/spelling diagnostics fixes Message-ID: <7a38b869-4884-a9c0-8b0b-1e26c8f50d5f@gmail.com> Date: Tue, 14 May 2019 15:32:55 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 MIME-Version: 1.0 X-IsSubscribed: yes The attached patch adjusts the expected test output to the quoting, spelling and other formatting changes in diagnostics to fix issues pointed out by the -Wformat-diag warning. Martin gcc/testsuite/ChangeLog: * c-c++-common/Wbool-operation-1.c: Adjust text of expected diagnostics. * c-c++-common/Wvarargs-2.c: Same. * c-c++-common/Wvarargs.c: Same. * c-c++-common/pr51768.c: Same. * c-c++-common/tm/inline-asm.c: Same. * c-c++-common/tm/safe-1.c: Same. * g++.dg/asm-qual-1.C: Same. * g++.dg/asm-qual-3.C: Same. * g++.dg/conversion/dynamic1.C: Same. * g++.dg/cpp0x/constexpr-89599.C: Same. * g++.dg/cpp0x/constexpr-cast.C: Same. * g++.dg/cpp0x/constexpr-shift1.C: Same. * g++.dg/cpp0x/lambda/lambda-conv11.C: Same. * g++.dg/cpp0x/nullptr04.C: Same. * g++.dg/cpp0x/static_assert12.C: Same. * g++.dg/cpp0x/static_assert8.C: Same. * g++.dg/cpp1y/lambda-conv1.C: Same. * g++.dg/cpp1y/pr79393-3.C: Same. * g++.dg/cpp1y/static_assert1.C: Same. * g++.dg/cpp1z/constexpr-if4.C: Same. * g++.dg/cpp1z/constexpr-if5.C: Same. * g++.dg/cpp1z/constexpr-if9.C: Same. * g++.dg/eh/goto2.C: Same. * g++.dg/eh/goto3.C: Same. * g++.dg/expr/static_cast8.C: Same. * g++.dg/ext/flexary5.C: Same. * g++.dg/ext/utf-array-short-wchar.C: Same. * g++.dg/ext/utf-array.C: Same. * g++.dg/ext/utf8-2.C: Same. * g++.dg/gomp/loop-4.C: Same. * g++.dg/gomp/macro-4.C: Same. * g++.dg/gomp/udr-1.C: Same. * g++.dg/init/initializer-string-too-long.C: Same. * g++.dg/other/offsetof9.C: Same. * g++.dg/ubsan/pr63956.C: Same. * g++.dg/warn/Wbool-operation-1.C: Same. * g++.dg/warn/Wtype-limits-Wextra.C: Same. * g++.dg/warn/Wtype-limits.C: Same. * g++.dg/wrappers/pr88680.C: Same. * g++.old-deja/g++.mike/eh55.C: Same. * gcc.dg/Wsign-compare-1.c: Same. * gcc.dg/Wtype-limits-Wextra.c: Same. * gcc.dg/Wtype-limits.c: Same. * gcc.dg/Wunknownprag.c: Same. * gcc.dg/Wunsuffixed-float-constants-1.c: Same. * gcc.dg/asm-6.c: Same. * gcc.dg/asm-qual-1.c: Same. * gcc.dg/cast-1.c: Same. * gcc.dg/cast-2.c: Same. * gcc.dg/cast-3.c: Same. * gcc.dg/cpp/source_date_epoch-2.c: Same. * gcc.dg/debug/pr85252.c: Same. * gcc.dg/dfp/cast-bad.c: Same. * gcc.dg/format/gcc_diag-1.c: Same. * gcc.dg/format/gcc_diag-11.c: Same.New test. * gcc.dg/gcc_diag-11.c: Same.New test. * gcc.dg/gnu-cond-expr-2.c: Same. * gcc.dg/gnu-cond-expr-3.c: Same. * gcc.dg/gomp/macro-4.c: Same. * gcc.dg/init-bad-1.c: Same. * gcc.dg/init-bad-2.c: Same. * gcc.dg/init-bad-3.c: Same. * gcc.dg/pr27528.c: Same. * gcc.dg/pr48552-1.c: Same. * gcc.dg/pr48552-2.c: Same. * gcc.dg/pr59846.c: Same. * gcc.dg/pr61096-1.c: Same. * gcc.dg/pr8788-1.c: Same. * gcc.dg/pr90082.c: Same. * gcc.dg/simd-2.c: Same. * gcc.dg/spellcheck-params-2.c: Same. * gcc.dg/spellcheck-params.c: Same. * gcc.dg/strlenopt-49.c: Same. * gcc.dg/tm/pr52141.c: Same. * gcc.dg/torture/pr51106-1.c: Same. * gcc.dg/torture/pr51106-2.c: Same. * gcc.dg/utf-array-short-wchar.c: Same. * gcc.dg/utf-array.c: Same. * gcc.dg/utf8-2.c: Same. * gcc.dg/warn-sprintf-no-nul.c: Same. * gcc.target/i386/asm-flag-0.c: Same. * gcc.target/i386/inline_error.c: Same. * gcc.target/i386/pr30848.c: Same. * gcc.target/i386/pr39082-1.c: Same. * gcc.target/i386/pr39678.c: Same. * gcc.target/i386/pr57756.c: Same. * gcc.target/i386/pr68843-1.c: Same. * gcc.target/i386/pr79804.c: Same. * gcc.target/i386/pr82673.c: Same. * obj-c++.dg/class-protocol-1.mm: Same. * obj-c++.dg/exceptions-3.mm: Same. * obj-c++.dg/exceptions-4.mm: Same. * obj-c++.dg/exceptions-5.mm: Same. * obj-c++.dg/exceptions-6.mm: Same. * obj-c++.dg/method-12.mm: Same. * obj-c++.dg/method-13.mm: Same. * obj-c++.dg/method-6.mm: Same. * obj-c++.dg/method-7.mm: Same. * obj-c++.dg/method-9.mm: Same. * obj-c++.dg/method-lookup-1.mm: Same. * obj-c++.dg/proto-lossage-4.mm: Same. * obj-c++.dg/protocol-qualifier-2.mm: Same. * objc.dg/call-super-2.m: Same. * objc.dg/class-protocol-1.m: Same. * objc.dg/desig-init-1.m: Same. * objc.dg/exceptions-3.m: Same. * objc.dg/exceptions-4.m: Same. * objc.dg/exceptions-5.m: Same. * objc.dg/exceptions-6.m: Same. * objc.dg/method-19.m: Same. * objc.dg/method-2.m: Same. * objc.dg/method-5.m: Same. * objc.dg/method-6.m: Same. * objc.dg/method-7.m: Same. * objc.dg/method-lookup-1.m: Same. * objc.dg/proto-hier-1.m: Same. * objc.dg/proto-lossage-4.m: Same. diff --git a/gcc/testsuite/c-c++-common/Wbool-operation-1.c b/gcc/testsuite/c-c++-common/Wbool-operation-1.c index 552b044c7bb..04891878155 100644 --- a/gcc/testsuite/c-c++-common/Wbool-operation-1.c +++ b/gcc/testsuite/c-c++-common/Wbool-operation-1.c @@ -15,18 +15,18 @@ fn (bool b, bool b2, T b3, int n, v4si v) { int r = 0; - r += ~b; /* { dg-warning "on an expression of type bool|on a boolean expression" } */ - r += n + ~b; /* { dg-warning "on an expression of type bool|on a boolean expression" } */ - r += ~(n == 1); /* { dg-warning "on an expression of type bool|on a boolean expression" } */ - r += ~(n || 1); /* { dg-warning "on an expression of type bool|on a boolean expression" } */ - r += ~b == 1; /* { dg-warning "on an expression of type bool|on a boolean expression" } */ - r += ~(++n, n == 1); /* { dg-warning "on an expression of type bool|on a boolean expression" } */ - r += ~(++n, n > 1); /* { dg-warning "on an expression of type bool|on a boolean expression" } */ - r += ~(++n, n && 1); /* { dg-warning "on an expression of type bool|on a boolean expression" } */ - r += (++n, ~b); /* { dg-warning "on an expression of type bool|on a boolean expression" } */ - r += ~b3; /* { dg-warning "on an expression of type bool|on a boolean expression" } */ - r += ~foo (); /* { dg-warning "on an expression of type bool|on a boolean expression" } */ - r += ~(bool) !1; /* { dg-warning "on an expression of type bool|on a boolean expression" } */ + r += ~b; /* { dg-warning "on an expression of type 'bool'|on a boolean expression" } */ + r += n + ~b; /* { dg-warning "on an expression of type 'bool'|on a boolean expression" } */ + r += ~(n == 1); /* { dg-warning "on an expression of type 'bool'|on a boolean expression" } */ + r += ~(n || 1); /* { dg-warning "on an expression of type 'bool'|on a boolean expression" } */ + r += ~b == 1; /* { dg-warning "on an expression of type 'bool'|on a boolean expression" } */ + r += ~(++n, n == 1); /* { dg-warning "on an expression of type 'bool'|on a boolean expression" } */ + r += ~(++n, n > 1); /* { dg-warning "on an expression of type 'bool'|on a boolean expression" } */ + r += ~(++n, n && 1); /* { dg-warning "on an expression of type 'bool'|on a boolean expression" } */ + r += (++n, ~b); /* { dg-warning "on an expression of type 'bool'|on a boolean expression" } */ + r += ~b3; /* { dg-warning "on an expression of type 'bool'|on a boolean expression" } */ + r += ~foo (); /* { dg-warning "on an expression of type 'bool'|on a boolean expression" } */ + r += ~(bool) !1; /* { dg-warning "on an expression of type 'bool'|on a boolean expression" } */ v = ~v; r += ~(int) b; diff --git a/gcc/testsuite/c-c++-common/Wvarargs-2.c b/gcc/testsuite/c-c++-common/Wvarargs-2.c index a6b51f19e60..08d3b94a087 100644 --- a/gcc/testsuite/c-c++-common/Wvarargs-2.c +++ b/gcc/testsuite/c-c++-common/Wvarargs-2.c @@ -9,7 +9,7 @@ void err (int a) { va_list vp; - va_start (vp, a); // { dg-error "used in function with fixed args" } + va_start (vp, a); // { dg-error "used in function with fixed arguments" } } void diff --git a/gcc/testsuite/c-c++-common/Wvarargs.c b/gcc/testsuite/c-c++-common/Wvarargs.c index 71d8c5dff93..bfd8276a292 100644 --- a/gcc/testsuite/c-c++-common/Wvarargs.c +++ b/gcc/testsuite/c-c++-common/Wvarargs.c @@ -6,7 +6,7 @@ void err (int a) { va_list vp; - va_start (vp, a); // { dg-error "used in function with fixed args" } + va_start (vp, a); // { dg-error "used in function with fixed arguments" } } #pragma GCC diagnostic push diff --git a/gcc/testsuite/c-c++-common/pr51768.c b/gcc/testsuite/c-c++-common/pr51768.c index 082594ccad7..c30039226b3 100644 --- a/gcc/testsuite/c-c++-common/pr51768.c +++ b/gcc/testsuite/c-c++-common/pr51768.c @@ -5,7 +5,7 @@ void foo (void) { - asm goto ("" : : : : lab, lab, lab2, lab); /* { dg-error "duplicate asm operand name" } */ + asm goto ("" : : : : lab, lab, lab2, lab); /* { dg-error "duplicate 'asm' operand name" } */ lab:; lab2:; } @@ -13,7 +13,7 @@ lab2:; void bar (void) { - asm goto ("" : : [lab] "i" (0) : : lab); /* { dg-error "duplicate asm operand name" } */ + asm goto ("" : : [lab] "i" (0) : : lab); /* { dg-error "duplicate 'asm' operand name" } */ lab:; } @@ -21,5 +21,5 @@ void baz (void) { int x; - asm ("" : [lab] "=r" (x) : [lab] "r" (x)); /* { dg-error "duplicate asm operand name" } */ + asm ("" : [lab] "=r" (x) : [lab] "r" (x)); /* { dg-error "duplicate 'asm' operand name" } */ } diff --git a/gcc/testsuite/c-c++-common/tm/inline-asm.c b/gcc/testsuite/c-c++-common/tm/inline-asm.c index eefd347dc8f..73892601897 100644 --- a/gcc/testsuite/c-c++-common/tm/inline-asm.c +++ b/gcc/testsuite/c-c++-common/tm/inline-asm.c @@ -4,7 +4,7 @@ static inline void inline_death () { - __asm__ (""); /* { dg-error "asm not allowed" } */ + __asm__ (""); /* { dg-error "'asm' not allowed" } */ } void diff --git a/gcc/testsuite/c-c++-common/tm/safe-1.c b/gcc/testsuite/c-c++-common/tm/safe-1.c index 4a81a78c396..504113e8eff 100644 --- a/gcc/testsuite/c-c++-common/tm/safe-1.c +++ b/gcc/testsuite/c-c++-common/tm/safe-1.c @@ -39,8 +39,8 @@ foo(void) (*pi)(); /* { dg-error "unsafe indirect function call" } */ (*pu)(); /* { dg-error "unsafe indirect function call" } */ - asm(""); /* { dg-error "asm not allowed" } */ - asm("" : "=g"(i)); /* { dg-error "asm not allowed" } */ + asm(""); /* { dg-error "'asm' not allowed" } */ + asm("" : "=g"(i)); /* { dg-error "'asm' not allowed" } */ return fc(i); } @@ -62,8 +62,8 @@ bar(void) (*pm)(); (*pu)(); /* { dg-error "unsafe indirect function call" } */ - asm(""); /* { dg-error "asm not allowed" } */ - asm("" : "=g"(i)); /* { dg-error "asm not allowed" } */ + asm(""); /* { dg-error "'asm' not allowed" } */ + asm("" : "=g"(i)); /* { dg-error "'asm' not allowed" } */ return fc(i); } diff --git a/gcc/testsuite/g++.dg/asm-qual-1.C b/gcc/testsuite/g++.dg/asm-qual-1.C index 3fba592ee99..1bb217fa99b 100644 --- a/gcc/testsuite/g++.dg/asm-qual-1.C +++ b/gcc/testsuite/g++.dg/asm-qual-1.C @@ -7,7 +7,7 @@ f () { asm volatile (""); - asm const (""); // { dg-error {'const' is not an asm qualifier} } + asm const (""); // { dg-error {'const' is not an 'asm' qualifier} } - asm __restrict (""); // { dg-error {'__restrict' is not an asm qualifier} } + asm __restrict (""); // { dg-error {'__restrict' is not an 'asm' qualifier} } } diff --git a/gcc/testsuite/g++.dg/asm-qual-3.C b/gcc/testsuite/g++.dg/asm-qual-3.C index 0bf60697ea5..80573cb4358 100644 --- a/gcc/testsuite/g++.dg/asm-qual-3.C +++ b/gcc/testsuite/g++.dg/asm-qual-3.C @@ -2,11 +2,11 @@ // { dg-do compile } // { dg-options "-std=gnu++98" } -asm const (""); // { dg-error {'const' is not an asm qualifier} } -asm volatile (""); // { dg-warning {asm qualifier 'volatile' ignored outside of function body} } +asm const (""); // { dg-error {'const' is not an 'asm' qualifier} } +asm volatile (""); // { dg-warning {'asm' qualifier 'volatile' ignored outside of function body} } asm restrict (""); // { dg-error {expected '\(' before 'restrict'} } -asm inline (""); // { dg-error {asm qualifier outside of function body} } -asm goto (""); // { dg-error {asm qualifier outside of function body} } +asm inline (""); // { dg-error {'asm' qualifier outside of function body} } +asm goto (""); // { dg-error {'asm' qualifier outside of function body} } // There are many other things wrong with this code, so: // { dg-excess-errors "" } diff --git a/gcc/testsuite/g++.dg/conversion/dynamic1.C b/gcc/testsuite/g++.dg/conversion/dynamic1.C index a781cbaa3fb..3c8739c5422 100644 --- a/gcc/testsuite/g++.dg/conversion/dynamic1.C +++ b/gcc/testsuite/g++.dg/conversion/dynamic1.C @@ -11,5 +11,5 @@ A& bar(); void baz() { - dynamic_cast( bar().foo ); // { dg-error "cannot dynamic_cast" } + dynamic_cast( bar().foo ); // { dg-error "cannot 'dynamic_cast'" } } diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-89599.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-89599.C index 07760a302a7..010416a77a1 100644 --- a/gcc/testsuite/g++.dg/cpp0x/constexpr-89599.C +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-89599.C @@ -2,5 +2,5 @@ // { dg-do compile { target c++11 } } void foo (int x) {} -constexpr void *arr[2] = { (void*) &foo, (void *) foo };// { dg-error "a reinterpret_cast is not a constant expression" } -constexpr void *ptr = (void *) &foo; // { dg-error "a reinterpret_cast is not a constant expression" } +constexpr void *arr[2] = { (void*) &foo, (void *) foo };// { dg-error "'reinterpret_cast' is not a constant expression" } +constexpr void *ptr = (void *) &foo; // { dg-error "'reinterpret_cast' is not a constant expression" } diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-cast.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-cast.C index e0c7ed33ac7..da76a3dc7bc 100644 --- a/gcc/testsuite/g++.dg/cpp0x/constexpr-cast.C +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-cast.C @@ -7,8 +7,8 @@ int i; // The following was accepted due to bug 49171. constexpr void *q = reinterpret_cast(&i); // { dg-error "not a constant expression" } -constexpr void *r0 = reinterpret_cast(1); // { dg-error "not a constant expression|reinterpret_cast from integer to pointer" } -constexpr void *r1 = reinterpret_cast(sizeof 'x'); // { dg-error ".reinterpret_cast\\(1\[ul\]\*\\). is not a constant expression" } +constexpr void *r0 = reinterpret_cast(1); // { dg-error "not a constant expression|'reinterpret_cast' from integer to pointer" } +constexpr void *r1 = reinterpret_cast(sizeof 'x'); // { dg-error "'reinterpret_cast\\(1\[ul\]\*\\)' is not a constant expression" } template constexpr bool f () diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-shift1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-shift1.C index c1cfb1eebdb..1970122f549 100644 --- a/gcc/testsuite/g++.dg/cpp0x/constexpr-shift1.C +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-shift1.C @@ -11,7 +11,7 @@ constexpr int i1 = fn1 (1, -1); // { dg-message "in .constexpr. expansion of " } constexpr int fn2 (int i, int j) { - return i << j; // { dg-error "is >= than the precision of the left operand" } + return i << j; // { dg-error "is greater than or equal to the precision .. of the left operand" } } constexpr int i2 = fn2 (1, 200); // { dg-message "in .constexpr. expansion of " } @@ -43,7 +43,7 @@ constexpr int i5 = fn5 (__INT_MAX__, 1); constexpr int fn6 (unsigned int i, unsigned int j) { - return i << j; // { dg-error "is >= than the precision of the left operand" } + return i << j; // { dg-error "is greater than or equal to the precision .. of the left operand" } } constexpr int i6 = fn6 (1, -1); // { dg-message "in .constexpr. expansion of " } @@ -67,7 +67,7 @@ constexpr int i8 = fn8 (-1, 1); constexpr int fn9 (int i, int j) { - return i >> j; // { dg-error "is >= than the precision of the left operand" } + return i >> j; // { dg-error "is greater than or equal to the precision .. of the left operand" } } constexpr int i9 = fn9 (1, 200); // { dg-message "in .constexpr. expansion of " } diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv11.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv11.C index 4b8d6487f5c..ec08f504fab 100644 --- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv11.C +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv11.C @@ -4,7 +4,7 @@ void foo() { int i; - static_cast([i]{}); // { dg-error "invalid static_cast" } - static_cast([=]{}); // { dg-error "invalid static_cast" } - static_cast([&]{}); // { dg-error "invalid static_cast" } + static_cast([i]{}); // { dg-error "invalid 'static_cast'" } + static_cast([=]{}); // { dg-error "invalid 'static_cast'" } + static_cast([&]{}); // { dg-error "invalid 'static_cast'" } } diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr04.C b/gcc/testsuite/g++.dg/cpp0x/nullptr04.C index 372ac51cd7b..2b9017865f7 100644 --- a/gcc/testsuite/g++.dg/cpp0x/nullptr04.C +++ b/gcc/testsuite/g++.dg/cpp0x/nullptr04.C @@ -4,13 +4,13 @@ __extension__ typedef __INTPTR_TYPE__ intptr_t; -const int n4 = static_cast(nullptr); // { dg-error "invalid static_cast " } +const int n4 = static_cast(nullptr); // { dg-error "invalid 'static_cast' " } const short int n5 = reinterpret_cast(nullptr); // { dg-error "loses precision" } const intptr_t n6 = reinterpret_cast(nullptr); const intptr_t n7 = (intptr_t)nullptr; decltype(nullptr) mynull = 0; -const int n8 = static_cast(mynull); // { dg-error "invalid static_cast " } +const int n8 = static_cast(mynull); // { dg-error "invalid 'static_cast' " } const short int n9 = reinterpret_cast(mynull); // { dg-error "loses precision" } const intptr_t n10 = reinterpret_cast(mynull); const intptr_t n11 = (intptr_t)mynull; diff --git a/gcc/testsuite/g++.dg/cpp0x/static_assert12.C b/gcc/testsuite/g++.dg/cpp0x/static_assert12.C index 5d59e540910..2ff5e0092a5 100644 --- a/gcc/testsuite/g++.dg/cpp0x/static_assert12.C +++ b/gcc/testsuite/g++.dg/cpp0x/static_assert12.C @@ -27,4 +27,4 @@ main() float_thing(1); } -// { dg-warning "static_assert without a message only available with " "" { target *-*-* } 21 } +// { dg-warning "'static_assert' without a message only available with " "" { target *-*-* } 21 } diff --git a/gcc/testsuite/g++.dg/cpp0x/static_assert8.C b/gcc/testsuite/g++.dg/cpp0x/static_assert8.C index 239fe17e273..bca38ffa89a 100644 --- a/gcc/testsuite/g++.dg/cpp0x/static_assert8.C +++ b/gcc/testsuite/g++.dg/cpp0x/static_assert8.C @@ -6,4 +6,4 @@ static_assert (1 == 0,); // { dg-error "expected string-literal before '\\)'" } static_assert (1 == 0, "oops"); // { dg-error "static assertion failed" } -// { dg-error "static_assert without a message only available with " "" { target { ! c++17 } } 3 } +// { dg-error "'static_assert' without a message only available with " "" { target { ! c++17 } } 3 } diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-conv1.C b/gcc/testsuite/g++.dg/cpp1y/lambda-conv1.C index 2e4ec4964d5..25721259c6b 100644 --- a/gcc/testsuite/g++.dg/cpp1y/lambda-conv1.C +++ b/gcc/testsuite/g++.dg/cpp1y/lambda-conv1.C @@ -4,10 +4,10 @@ void foo() { int i; - static_cast([i](auto){}); // { dg-error "invalid static_cast" } - static_cast([=](auto){}); // { dg-error "invalid static_cast" } - static_cast([&](auto){}); // { dg-error "invalid static_cast" } - static_cast([i](auto x){ return x; }); // { dg-error "invalid static_cast" } - static_cast([=](auto x){ return x; }); // { dg-error "invalid static_cast" } - static_cast([&](auto x){ return x; }); // { dg-error "invalid static_cast" } + static_cast([i](auto){}); // { dg-error "invalid 'static_cast'" } + static_cast([=](auto){}); // { dg-error "invalid 'static_cast'" } + static_cast([&](auto){}); // { dg-error "invalid 'static_cast'" } + static_cast([i](auto x){ return x; }); // { dg-error "invalid 'static_cast'" } + static_cast([=](auto x){ return x; }); // { dg-error "invalid 'static_cast'" } + static_cast([&](auto x){ return x; }); // { dg-error "invalid 'static_cast'" } } diff --git a/gcc/testsuite/g++.dg/cpp1y/pr79393-3.C b/gcc/testsuite/g++.dg/cpp1y/pr79393-3.C index 23dc2650900..3c73cbbb659 100644 --- a/gcc/testsuite/g++.dg/cpp1y/pr79393-3.C +++ b/gcc/testsuite/g++.dg/cpp1y/pr79393-3.C @@ -18,7 +18,7 @@ struct B : virtual A }; B::~B () { - throw 1; // { dg-warning "will always call terminate" } + throw 1; // { dg-warning "will always call 'terminate'" } } struct C : virtual A diff --git a/gcc/testsuite/g++.dg/cpp1y/static_assert1.C b/gcc/testsuite/g++.dg/cpp1y/static_assert1.C index ef655f49097..06815fdace2 100644 --- a/gcc/testsuite/g++.dg/cpp1y/static_assert1.C +++ b/gcc/testsuite/g++.dg/cpp1y/static_assert1.C @@ -28,4 +28,4 @@ main() float_thing(1); } -// { dg-warning "static_assert without a message only available with " "" { target *-*-* } 21 } +// { dg-warning "'static_assert' without a message only available with " "" { target *-*-* } 21 } diff --git a/gcc/testsuite/g++.dg/cpp1z/constexpr-if4.C b/gcc/testsuite/g++.dg/cpp1z/constexpr-if4.C index 612eff83b1e..871e31a286d 100644 --- a/gcc/testsuite/g++.dg/cpp1z/constexpr-if4.C +++ b/gcc/testsuite/g++.dg/cpp1z/constexpr-if4.C @@ -4,7 +4,7 @@ void f() { goto l; // { dg-message "from here" } - if constexpr (false) // { dg-message "enters constexpr if" } + if constexpr (false) // { dg-message "enters 'constexpr if'" } { l:; // { dg-error "jump to label" } } diff --git a/gcc/testsuite/g++.dg/cpp1z/constexpr-if5.C b/gcc/testsuite/g++.dg/cpp1z/constexpr-if5.C index 69d03e3c8b8..9d30b0e32f6 100644 --- a/gcc/testsuite/g++.dg/cpp1z/constexpr-if5.C +++ b/gcc/testsuite/g++.dg/cpp1z/constexpr-if5.C @@ -3,7 +3,7 @@ void f() { - if constexpr (false) // { dg-message "enters constexpr if" } + if constexpr (false) // { dg-message "enters 'constexpr if'" } { goto l; // { dg-message "from here" } } diff --git a/gcc/testsuite/g++.dg/cpp1z/constexpr-if9.C b/gcc/testsuite/g++.dg/cpp1z/constexpr-if9.C index 748278af8c9..8aa87f74437 100644 --- a/gcc/testsuite/g++.dg/cpp1z/constexpr-if9.C +++ b/gcc/testsuite/g++.dg/cpp1z/constexpr-if9.C @@ -4,7 +4,7 @@ void f(int i) { switch (i) - if constexpr (false) // { dg-message "enters constexpr if" } + if constexpr (false) // { dg-message "enters 'constexpr if'" } { case 42:; // { dg-error "jump to case label" } } diff --git a/gcc/testsuite/g++.dg/eh/goto2.C b/gcc/testsuite/g++.dg/eh/goto2.C index 1cd254c0404..7f22f50315f 100644 --- a/gcc/testsuite/g++.dg/eh/goto2.C +++ b/gcc/testsuite/g++.dg/eh/goto2.C @@ -8,6 +8,6 @@ try } catch (...) { l2: ; // { dg-error "jump to label 'l2'" } - // { dg-message "enters catch block" "" { target *-*-*} .-1 } - goto l1; // { dg-message "from here|enters try block" } + // { dg-message "enters 'catch' block" "" { target *-*-*} .-1 } + goto l1; // { dg-message "from here|enters 'try' block" } } diff --git a/gcc/testsuite/g++.dg/eh/goto3.C b/gcc/testsuite/g++.dg/eh/goto3.C index 250324e08f4..415782cfd1f 100644 --- a/gcc/testsuite/g++.dg/eh/goto3.C +++ b/gcc/testsuite/g++.dg/eh/goto3.C @@ -9,6 +9,6 @@ try } catch (...) { l2: ; // { dg-error "jump to label 'l2'" } - // { dg-message "enters catch block" "" { target *-*-*} .-1 } - goto l1; // { dg-message "from here|enters try block" } + // { dg-message "enters 'catch' block" "" { target *-*-*} .-1 } + goto l1; // { dg-message "from here|enters 'try' block" } } diff --git a/gcc/testsuite/g++.dg/expr/static_cast8.C b/gcc/testsuite/g++.dg/expr/static_cast8.C index dc4d2162d6c..6dd7560136c 100644 --- a/gcc/testsuite/g++.dg/expr/static_cast8.C +++ b/gcc/testsuite/g++.dg/expr/static_cast8.C @@ -9,9 +9,9 @@ extern C* c; void pointers(C* c, A2* a2, B1* b1) { - (void) static_cast(c); // { dg-error "invalid static_cast" } - (void) static_cast(a2); // { dg-error "invalid static_cast" } - (void) static_cast(b1); // { dg-error "invalid static_cast" } + (void) static_cast(c); // { dg-error "invalid 'static_cast'" } + (void) static_cast(a2); // { dg-error "invalid 'static_cast'" } + (void) static_cast(b1); // { dg-error "invalid 'static_cast'" } } struct D1; // { dg-message "note: class type 'D1' is incomplete" } @@ -21,7 +21,7 @@ struct E2; // { dg-message "note: class type 'E2' is incomplete" } void references(C& c, D2& d2, E1& e1) { - (void) static_cast(c); // { dg-error "invalid static_cast" } - (void) static_cast(d2); // { dg-error "invalid static_cast" } - (void) static_cast(e1); // { dg-error "invalid static_cast" } + (void) static_cast(c); // { dg-error "invalid 'static_cast'" } + (void) static_cast(d2); // { dg-error "invalid 'static_cast'" } + (void) static_cast(e1); // { dg-error "invalid 'static_cast'" } } diff --git a/gcc/testsuite/g++.dg/ext/flexary5.C b/gcc/testsuite/g++.dg/ext/flexary5.C index d6d8e32818f..d5ec1320496 100644 --- a/gcc/testsuite/g++.dg/ext/flexary5.C +++ b/gcc/testsuite/g++.dg/ext/flexary5.C @@ -62,7 +62,7 @@ ASSERT_AT_END (D4, a); // below is benign since GCC computes the expected value. struct D5: E1, E2, NE { char a[]; }; -ASSERT_AT_END (D5, a); // { dg-warning "offsetof within non-standard-layout" } +ASSERT_AT_END (D5, a); // { dg-warning "'offsetof' within non-standard-layout" } struct A2x_1 { size_t n; @@ -166,29 +166,29 @@ struct A5x { struct D22: A5x, E1, E2 { }; -ASSERT_AT_END (D22, a); // { dg-warning "offsetof within non-standard-layout" } +ASSERT_AT_END (D22, a); // { dg-warning "'offsetof' within non-standard-layout" } struct D23: E1, A5x, E2 { }; -ASSERT_AT_END (D23, a); // { dg-warning "offsetof within non-standard-layout" } +ASSERT_AT_END (D23, a); // { dg-warning "'offsetof' within non-standard-layout" } struct D24: E1, E2, A5x { }; -ASSERT_AT_END (D24, a); // { dg-warning "offsetof within non-standard-layout" } +ASSERT_AT_END (D24, a); // { dg-warning "'offsetof' within non-standard-layout" } struct DA5x: A5x { }; struct D25: DA5x, E1, E2 { }; -ASSERT_AT_END (D25, a); // { dg-warning "offsetof within non-standard-layout" } +ASSERT_AT_END (D25, a); // { dg-warning "'offsetof' within non-standard-layout" } struct D26: E1, DA5x, E2 { }; -ASSERT_AT_END (D26, a); // { dg-warning "offsetof within non-standard-layout" } +ASSERT_AT_END (D26, a); // { dg-warning "'offsetof' within non-standard-layout" } struct D27: E1, E2, DA5x { }; -ASSERT_AT_END (D27, a); // { dg-warning "offsetof within non-standard-layout" } +ASSERT_AT_END (D27, a); // { dg-warning "'offsetof' within non-standard-layout" } // Verfify that a flexible array member is diagnosed even when deep // in the base class hierarchy. diff --git a/gcc/testsuite/g++.dg/ext/utf-array-short-wchar.C b/gcc/testsuite/g++.dg/ext/utf-array-short-wchar.C index f37f93c8b73..8f0a7327ab2 100644 --- a/gcc/testsuite/g++.dg/ext/utf-array-short-wchar.C +++ b/gcc/testsuite/g++.dg/ext/utf-array-short-wchar.C @@ -21,9 +21,9 @@ const char16_t s16_2[] = U"ab"; /* { dg-error "from a string literal with type a const char16_t s16_3[] = L"ab"; /* { dg-error "from a string literal with type array of .wchar_t." } */ const char16_t s16_4[] = u8"ab"; /* { dg-error "from a string literal with type array of .char." } */ -const char16_t s16_5[0] = u"ab"; /* { dg-error "chars is too long" } */ -const char16_t s16_6[1] = u"ab"; /* { dg-error "chars is too long" } */ -const char16_t s16_7[2] = u"ab"; /* { dg-error "chars is too long" } */ +const char16_t s16_5[0] = u"ab"; /* { dg-error "initializer-string for 'const char16_t \\\[0]' is too long" } */ +const char16_t s16_6[1] = u"ab"; /* { dg-error "initializer-string for 'const char16_t \\\[1]' is too long" } */ +const char16_t s16_7[2] = u"ab"; /* { dg-error "initializer-string for 'const char16_t \\\[2]' is too long" } */ const char16_t s16_8[3] = u"ab"; const char16_t s16_9[4] = u"ab"; @@ -33,9 +33,9 @@ const char32_t s32_2[] = U"ab"; const char32_t s32_3[] = L"ab"; /* { dg-error "from a string literal with type array of .wchar_t." } */ const char32_t s32_4[] = u8"ab"; /* { dg-error "from a string literal with type array of .char." } */ -const char32_t s32_5[0] = U"ab"; /* { dg-error "chars is too long" } */ -const char32_t s32_6[1] = U"ab"; /* { dg-error "chars is too long" } */ -const char32_t s32_7[2] = U"ab"; /* { dg-error "chars is too long" } */ +const char32_t s32_5[0] = U"ab"; /* { dg-error "initializer-string for 'const char32_t \\\[0]' is too long" } */ +const char32_t s32_6[1] = U"ab"; /* { dg-error "initializer-string for 'const char32_t \\\[1]' is too long" } */ +const char32_t s32_7[2] = U"ab"; /* { dg-error "initializer-string for 'const char32_t \\\[2]' is too long" } */ const char32_t s32_8[3] = U"ab"; const char32_t s32_9[4] = U"ab"; diff --git a/gcc/testsuite/g++.dg/ext/utf-array.C b/gcc/testsuite/g++.dg/ext/utf-array.C index 0e403db7e05..e539cd45063 100644 --- a/gcc/testsuite/g++.dg/ext/utf-array.C +++ b/gcc/testsuite/g++.dg/ext/utf-array.C @@ -21,9 +21,9 @@ const char16_t s16_2[] = U"ab"; /* { dg-error "from a string literal with type a const char16_t s16_3[] = L"ab"; /* { dg-error "from a string literal with type array of .wchar_t." } */ const char16_t s16_4[] = u8"ab"; /* { dg-error "from a string literal with type array of .char." } */ -const char16_t s16_5[0] = u"ab"; /* { dg-error "chars is too long" } */ -const char16_t s16_6[1] = u"ab"; /* { dg-error "chars is too long" } */ -const char16_t s16_7[2] = u"ab"; /* { dg-error "chars is too long" } */ +const char16_t s16_5[0] = u"ab"; /* { dg-error "initializer-string for 'const char16_t \\\[0]' is too long" } */ +const char16_t s16_6[1] = u"ab"; /* { dg-error "initializer-string for 'const char16_t \\\[1]' is too long" } */ +const char16_t s16_7[2] = u"ab"; /* { dg-error "initializer-string for 'const char16_t \\\[2]' is too long" } */ const char16_t s16_8[3] = u"ab"; const char16_t s16_9[4] = u"ab"; @@ -33,9 +33,9 @@ const char32_t s32_2[] = U"ab"; const char32_t s32_3[] = L"ab"; /* { dg-error "from a string literal with type array of .wchar_t." } */ const char32_t s32_4[] = u8"ab"; /* { dg-error "from a string literal with type array of .char." } */ -const char32_t s32_5[0] = U"ab"; /* { dg-error "chars is too long" } */ -const char32_t s32_6[1] = U"ab"; /* { dg-error "chars is too long" } */ -const char32_t s32_7[2] = U"ab"; /* { dg-error "chars is too long" } */ +const char32_t s32_5[0] = U"ab"; /* { dg-error "initializer-string for 'const char32_t \\\[0]' is too long" } */ +const char32_t s32_6[1] = U"ab"; /* { dg-error "initializer-string for 'const char32_t \\\[1]' is too long" } */ +const char32_t s32_7[2] = U"ab"; /* { dg-error "initializer-string for 'const char32_t \\\[2]' is too long" } */ const char32_t s32_8[3] = U"ab"; const char32_t s32_9[4] = U"ab"; diff --git a/gcc/testsuite/g++.dg/ext/utf8-2.C b/gcc/testsuite/g++.dg/ext/utf8-2.C index b13d55f1139..1db5c383fd6 100644 --- a/gcc/testsuite/g++.dg/ext/utf8-2.C +++ b/gcc/testsuite/g++.dg/ext/utf8-2.C @@ -12,16 +12,16 @@ const char16_t s1[] = u8"ab"; // { dg-error "from a string literal with type arr const char32_t s2[] = u8"ab"; // { dg-error "from a string literal with type array of .char." } const wchar_t s3[] = u8"ab"; // { dg-error "from a string literal with type array of .char." } -const u8_char_t t0[0] = u8"ab"; // { dg-error "chars is too long" } -const u8_char_t t1[1] = u8"ab"; // { dg-error "chars is too long" } -const u8_char_t t2[2] = u8"ab"; // { dg-error "chars is too long" } +const u8_char_t t0[0] = u8"ab"; // { dg-error "initializer-string for 'const u8_char_t \\\[0]' {aka 'const char \\\[0]'} is too long" } +const u8_char_t t1[1] = u8"ab"; // { dg-error "initializer-string for 'const u8_char_t \\\[1]' {aka 'const char \\\[1]'} is too long" } +const u8_char_t t2[2] = u8"ab"; // { dg-error "initializer-string for 'const u8_char_t \\\[2]' {aka 'const char \\\[2]'} is too long" } const u8_char_t t3[3] = u8"ab"; const u8_char_t t4[4] = u8"ab"; -const u8_char_t u0[0] = u8"\u2160."; // { dg-error "chars is too long" } -const u8_char_t u1[1] = u8"\u2160."; // { dg-error "chars is too long" } -const u8_char_t u2[2] = u8"\u2160."; // { dg-error "chars is too long" } -const u8_char_t u3[3] = u8"\u2160."; // { dg-error "chars is too long" } -const u8_char_t u4[4] = u8"\u2160."; // { dg-error "chars is too long" } +const u8_char_t u0[0] = u8"\u2160."; // { dg-error "initializer-string for 'const u8_char_t \\\[0]' {aka 'const char \\\[0]'} is too long" } +const u8_char_t u1[1] = u8"\u2160."; // { dg-error "initializer-string for 'const u8_char_t \\\[1]' {aka 'const char \\\[1]'} is too long" } +const u8_char_t u2[2] = u8"\u2160."; // { dg-error "initializer-string for 'const u8_char_t \\\[2]' {aka 'const char \\\[2]'} is too long" } +const u8_char_t u3[3] = u8"\u2160."; // { dg-error "initializer-string for 'const u8_char_t \\\[3]' {aka 'const char \\\[3]'} is too long" } +const u8_char_t u4[4] = u8"\u2160."; // { dg-error "initializer-string for 'const u8_char_t \\\[4]' {aka 'const char \\\[4]'} is too long" } const u8_char_t u5[5] = u8"\u2160."; const u8_char_t u6[6] = u8"\u2160."; diff --git a/gcc/testsuite/g++.dg/gomp/loop-4.C b/gcc/testsuite/g++.dg/gomp/loop-4.C index cd85dbdb989..c45d43efe8a 100644 --- a/gcc/testsuite/g++.dg/gomp/loop-4.C +++ b/gcc/testsuite/g++.dg/gomp/loop-4.C @@ -81,28 +81,28 @@ f0 () for (i = 64; i != 0; i += k) ; #pragma omp for - for (i = 0; i != 64; i += m) // { dg-error "increment is not constant 1 or -1 for != condition" } + for (i = 0; i != 64; i += m) // { dg-error "increment is not constant 1 or -1 for '!=' condition" } ; #pragma omp for - for (i = 64; i != 0; i -= m) // { dg-error "increment is not constant 1 or -1 for != condition" } + for (i = 64; i != 0; i -= m) // { dg-error "increment is not constant 1 or -1 for '!=' condition" } ; #pragma omp for - for (i = 0; i != 64; i -= n) // { dg-error "increment is not constant 1 or -1 for != condition" } + for (i = 0; i != 64; i -= n) // { dg-error "increment is not constant 1 or -1 for '!=' condition" } ; #pragma omp for - for (i = 64; i != 0; i += n) // { dg-error "increment is not constant 1 or -1 for != condition" } + for (i = 64; i != 0; i += n) // { dg-error "increment is not constant 1 or -1 for '!=' condition" } ; #pragma omp for - for (i = 0; i != 64; i += o) // { dg-error "increment is not constant 1 or -1 for != condition" } + for (i = 0; i != 64; i += o) // { dg-error "increment is not constant 1 or -1 for '!=' condition" } ; #pragma omp for - for (i = 64; i != 0; i -= o) // { dg-error "increment is not constant 1 or -1 for != condition" } + for (i = 64; i != 0; i -= o) // { dg-error "increment is not constant 1 or -1 for '!=' condition" } ; #pragma omp for - for (i = 0; i != 64; i -= p) // { dg-error "increment is not constant 1 or -1 for != condition" } + for (i = 0; i != 64; i -= p) // { dg-error "increment is not constant 1 or -1 for '!=' condition" } ; #pragma omp for - for (i = 64; i != 0; i += p) // { dg-error "increment is not constant 1 or -1 for != condition" } + for (i = 64; i != 0; i += p) // { dg-error "increment is not constant 1 or -1 for '!=' condition" } ; } @@ -165,63 +165,63 @@ f1 (I &x, I &y, I &u, I &v) for (i = y; i != x; i = l + i) ; #pragma omp for - for (i = x; i != y; i = i + 2) // { dg-error "increment is not constant 1 or -1 for != condition" } + for (i = x; i != y; i = i + 2) // { dg-error "increment is not constant 1 or -1 for '!=' condition" } ; #pragma omp for - for (i = x; i != y; i = 7 + i) // { dg-error "increment is not constant 1 or -1 for != condition" } + for (i = x; i != y; i = 7 + i) // { dg-error "increment is not constant 1 or -1 for '!=' condition" } ; #pragma omp for - for (i = y; i != x; i = i - 2) // { dg-error "increment is not constant 1 or -1 for != condition" } + for (i = y; i != x; i = i - 2) // { dg-error "increment is not constant 1 or -1 for '!=' condition" } ; #pragma omp for - for (i = y; i != x; i = -7 + i) // { dg-error "increment is not constant 1 or -1 for != condition" } + for (i = y; i != x; i = -7 + i) // { dg-error "increment is not constant 1 or -1 for '!=' condition" } ; #pragma omp for - for (i = x; i != y; i = i + m) // { dg-error "increment is not constant 1 or -1 for != condition" } + for (i = x; i != y; i = i + m) // { dg-error "increment is not constant 1 or -1 for '!=' condition" } ; #pragma omp for - for (i = x; i != y; i = m + i) // { dg-error "increment is not constant 1 or -1 for != condition" } + for (i = x; i != y; i = m + i) // { dg-error "increment is not constant 1 or -1 for '!=' condition" } ; #pragma omp for - for (i = y; i != x; i = i - m) // { dg-error "increment is not constant 1 or -1 for != condition" } + for (i = y; i != x; i = i - m) // { dg-error "increment is not constant 1 or -1 for '!=' condition" } ; #pragma omp for - for (i = y; i != x; i = -m + i) // { dg-error "increment is not constant 1 or -1 for != condition" } + for (i = y; i != x; i = -m + i) // { dg-error "increment is not constant 1 or -1 for '!=' condition" } ; #pragma omp for - for (i = x; i != y; i = i - n) // { dg-error "increment is not constant 1 or -1 for != condition" } + for (i = x; i != y; i = i - n) // { dg-error "increment is not constant 1 or -1 for '!=' condition" } ; #pragma omp for - for (i = x; i != y; i = -n + i) // { dg-error "increment is not constant 1 or -1 for != condition" } + for (i = x; i != y; i = -n + i) // { dg-error "increment is not constant 1 or -1 for '!=' condition" } ; #pragma omp for - for (i = y; i != x; i = i + n) // { dg-error "increment is not constant 1 or -1 for != condition" } + for (i = y; i != x; i = i + n) // { dg-error "increment is not constant 1 or -1 for '!=' condition" } ; #pragma omp for - for (i = y; i != x; i = n + i) // { dg-error "increment is not constant 1 or -1 for != condition" } + for (i = y; i != x; i = n + i) // { dg-error "increment is not constant 1 or -1 for '!=' condition" } ; #pragma omp for - for (i = x; i != y; i = i + o) // { dg-error "increment is not constant 1 or -1 for != condition" } + for (i = x; i != y; i = i + o) // { dg-error "increment is not constant 1 or -1 for '!=' condition" } ; #pragma omp for - for (i = x; i != y; i = o + i) // { dg-error "increment is not constant 1 or -1 for != condition" } + for (i = x; i != y; i = o + i) // { dg-error "increment is not constant 1 or -1 for '!=' condition" } ; #pragma omp for - for (i = y; i != x; i = i - o) // { dg-error "increment is not constant 1 or -1 for != condition" } + for (i = y; i != x; i = i - o) // { dg-error "increment is not constant 1 or -1 for '!=' condition" } ; #pragma omp for - for (i = y; i != x; i = -o + i) // { dg-error "increment is not constant 1 or -1 for != condition" } + for (i = y; i != x; i = -o + i) // { dg-error "increment is not constant 1 or -1 for '!=' condition" } ; #pragma omp for - for (i = x; i != y; i = i - p) // { dg-error "increment is not constant 1 or -1 for != condition" } + for (i = x; i != y; i = i - p) // { dg-error "increment is not constant 1 or -1 for '!=' condition" } ; #pragma omp for - for (i = x; i != y; i = -p + i) // { dg-error "increment is not constant 1 or -1 for != condition" } + for (i = x; i != y; i = -p + i) // { dg-error "increment is not constant 1 or -1 for '!=' condition" } ; #pragma omp for - for (i = y; i != x; i = i + p) // { dg-error "increment is not constant 1 or -1 for != condition" } + for (i = y; i != x; i = i + p) // { dg-error "increment is not constant 1 or -1 for '!=' condition" } ; #pragma omp for - for (i = y; i != x; i = p + i) // { dg-error "increment is not constant 1 or -1 for != condition" } + for (i = y; i != x; i = p + i) // { dg-error "increment is not constant 1 or -1 for '!=' condition" } ; } diff --git a/gcc/testsuite/g++.dg/gomp/macro-4.C b/gcc/testsuite/g++.dg/gomp/macro-4.C index 6a69f1a3ca1..dcc8bcbc8e5 100644 --- a/gcc/testsuite/g++.dg/gomp/macro-4.C +++ b/gcc/testsuite/g++.dg/gomp/macro-4.C @@ -10,9 +10,9 @@ void bar (void); void foo (void) { -#pragma omp p // { dg-warning "-:ignoring #pragma omp _Pragma" } +#pragma omp p // { dg-warning "-:ignoring '#pragma omp _Pragma'" } bar (); - omp_p // { dg-warning "-:ignoring #pragma omp _Pragma" } + omp_p // { dg-warning "-:ignoring '#pragma omp _Pragma'" } bar (); } @@ -22,8 +22,8 @@ foo (void) void baz (void) { -#pragma omp parallel // { dg-warning "-:ignoring #pragma omp serial" } +#pragma omp parallel // { dg-warning "-:ignoring '#pragma omp serial'" } bar (); - omp_parallel // { dg-warning "-:ignoring #pragma omp serial" } + omp_parallel // { dg-warning "-:ignoring '#pragma omp serial'" } bar (); } diff --git a/gcc/testsuite/g++.dg/gomp/udr-1.C b/gcc/testsuite/g++.dg/gomp/udr-1.C index 10c1c8dab92..c07a89b9d6a 100644 --- a/gcc/testsuite/g++.dg/gomp/udr-1.C +++ b/gcc/testsuite/g++.dg/gomp/udr-1.C @@ -86,11 +86,11 @@ namespace N5 namespace N6 { struct A { int a; A () : a (0) {} }; - #pragma omp declare reduction (| : const A : omp_out.a |= omp_in.a) // { dg-error "const, volatile or __restrict" } - #pragma omp declare reduction (+ : __const A : omp_out.a += omp_in.a) // { dg-error "const, volatile or __restrict" } + #pragma omp declare reduction (| : const A : omp_out.a |= omp_in.a) // { dg-error "'const', 'volatile' or '__restrict'" } + #pragma omp declare reduction (+ : __const A : omp_out.a += omp_in.a) // { dg-error "'const', 'volatile' or '__restrict'" } typedef volatile A T; - #pragma omp declare reduction (min : T : omp_out.a += omp_in.a) // { dg-error "const, volatile or __restrict" } - #pragma omp declare reduction (* : A *__restrict : omp_out->a *= omp_in->a)// { dg-error "const, volatile or __restrict" } + #pragma omp declare reduction (min : T : omp_out.a += omp_in.a) // { dg-error "'const', 'volatile' or '__restrict'" } + #pragma omp declare reduction (* : A *__restrict : omp_out->a *= omp_in->a)// { dg-error "'const', 'volatile' or '__restrict'" } } namespace N7 { @@ -98,21 +98,21 @@ namespace N7 template struct S { - #pragma omp declare reduction (| : T1 : omp_out |= omp_in) // { dg-error "const, volatile or __restrict" } - #pragma omp declare reduction (+ : T2 : omp_out += omp_in) // { dg-error "const, volatile or __restrict" } + #pragma omp declare reduction (| : T1 : omp_out |= omp_in) // { dg-error "'const', 'volatile' or '__restrict'" } + #pragma omp declare reduction (+ : T2 : omp_out += omp_in) // { dg-error "'const', 'volatile' or '__restrict'" } typedef T3 T; - #pragma omp declare reduction (min : T : omp_out += omp_in) // { dg-error "const, volatile or __restrict" } - #pragma omp declare reduction (* : T4 : omp_out *= omp_in) // { dg-error "const, volatile or __restrict" } + #pragma omp declare reduction (min : T : omp_out += omp_in) // { dg-error "'const', 'volatile' or '__restrict'" } + #pragma omp declare reduction (* : T4 : omp_out *= omp_in) // { dg-error "'const', 'volatile' or '__restrict'" } }; S s; template int foo () { - #pragma omp declare reduction (| : T1 : omp_out |= omp_in) // { dg-error "const, volatile or __restrict" } - #pragma omp declare reduction (+ : T2 : omp_out += omp_in) // { dg-error "const, volatile or __restrict" } + #pragma omp declare reduction (| : T1 : omp_out |= omp_in) // { dg-error "'const', 'volatile' or '__restrict'" } + #pragma omp declare reduction (+ : T2 : omp_out += omp_in) // { dg-error "'const', 'volatile' or '__restrict'" } typedef T3 T; - #pragma omp declare reduction (min : T : omp_out += omp_in) // { dg-error "const, volatile or __restrict" } - #pragma omp declare reduction (* : T4 : omp_out *= omp_in) // { dg-error "const, volatile or __restrict" } + #pragma omp declare reduction (min : T : omp_out += omp_in) // { dg-error "'const', 'volatile' or '__restrict'" } + #pragma omp declare reduction (* : T4 : omp_out *= omp_in) // { dg-error "'const', 'volatile' or '__restrict'" } return 0; } int x = foo (); diff --git a/gcc/testsuite/g++.dg/init/initializer-string-too-long.C b/gcc/testsuite/g++.dg/init/initializer-string-too-long.C index c4ce468bae4..064e1ace466 100644 --- a/gcc/testsuite/g++.dg/init/initializer-string-too-long.C +++ b/gcc/testsuite/g++.dg/init/initializer-string-too-long.C @@ -2,7 +2,7 @@ /* Verify that we highlight *which* string is too long. */ -char test[3][4] = { "ok", "too long", "ok" }; // { dg-error "initializer-string for array of chars is too long" } +char test[3][4] = { "ok", "too long", "ok" }; // { dg-error "initializer-string for 'char \\\[4]' is too long" } /* { dg-begin-multiline-output "" } char test[3][4] = { "ok", "too long", "ok" }; ^~~~~~~~~~ diff --git a/gcc/testsuite/g++.dg/other/offsetof9.C b/gcc/testsuite/g++.dg/other/offsetof9.C index bd80fa5e2cf..1936f2e5f76 100644 --- a/gcc/testsuite/g++.dg/other/offsetof9.C +++ b/gcc/testsuite/g++.dg/other/offsetof9.C @@ -4,14 +4,14 @@ struct A { int i; }; struct B : virtual A { }; -__SIZE_TYPE__ s = __builtin_offsetof (B, A::i); // { dg-warning "offsetof within non-standard-layout type" } +__SIZE_TYPE__ s = __builtin_offsetof (B, A::i); // { dg-warning "'offsetof' within non-standard-layout type" } template __SIZE_TYPE__ foo () { - return __builtin_offsetof (T, A::i) // { dg-warning "offsetof within non-standard-layout type" } - + __builtin_offsetof (B, A::i); // { dg-warning "offsetof within non-standard-layout type" } + return __builtin_offsetof (T, A::i) // { dg-warning "'offsetof' within non-standard-layout type" } + + __builtin_offsetof (B, A::i); // { dg-warning "'offsetof' within non-standard-layout type" } } __SIZE_TYPE__ t = foo (); diff --git a/gcc/testsuite/g++.dg/ubsan/pr63956.C b/gcc/testsuite/g++.dg/ubsan/pr63956.C index 34b5dd71ec2..cd67c32a547 100644 --- a/gcc/testsuite/g++.dg/ubsan/pr63956.C +++ b/gcc/testsuite/g++.dg/ubsan/pr63956.C @@ -11,7 +11,7 @@ fn1 (int a, int b) if (b != 2) a <<= b; // { dg-error "5 << -2.. is negative" "" { target *-*-* } .-1 } - // { dg-error "is >= than the precision of the left operand" "" { target *-*-* } .-2 } + // { dg-error "is greater than or equal to the precision of the left operand" "" { target *-*-* } .-2 } // { dg-error "-2 << 4.. is negative" "" { target *-*-* } .-3 } return a; } @@ -34,7 +34,7 @@ fn2 (int a, int b) if (b != 2) a >>= b; // { dg-error "4 >> -1.. is negative" "" { target *-*-* } .-1 } - // { dg-error "is >= than the precision of the left operand" "" { target *-*-* } .-2 } + // { dg-error "is greater than or equal to the precision of the left operand" "" { target *-*-* } .-2 } return a; } diff --git a/gcc/testsuite/g++.dg/warn/Wbool-operation-1.C b/gcc/testsuite/g++.dg/warn/Wbool-operation-1.C index 4512b858287..82e9ead445d 100644 --- a/gcc/testsuite/g++.dg/warn/Wbool-operation-1.C +++ b/gcc/testsuite/g++.dg/warn/Wbool-operation-1.C @@ -6,6 +6,6 @@ template decltype (~c{}) call () { - return ~false; // { dg-warning "on an expression of type bool" } + return ~false; // { dg-warning "on an expression of type 'bool'" } } template int call(); diff --git a/gcc/testsuite/g++.dg/warn/Wtype-limits-Wextra.C b/gcc/testsuite/g++.dg/warn/Wtype-limits-Wextra.C index 0cee96a8a98..99e1e89b4b7 100644 --- a/gcc/testsuite/g++.dg/warn/Wtype-limits-Wextra.C +++ b/gcc/testsuite/g++.dg/warn/Wtype-limits-Wextra.C @@ -30,10 +30,10 @@ void b (unsigned short x) void c (unsigned int x) { - if (x < 0) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */ - if (x >= 0) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */ - if (0 > x) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */ - if (0 <= x) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */ + if (x < 0) return;/* { dg-warning "comparison of unsigned expression in '< 0' is always false" } */ + if (x >= 0) return;/* { dg-warning "comparison of unsigned expression in '>= 0' is always true" } */ + if (0 > x) return;/* { dg-warning "comparison of unsigned expression in '< 0' is always false" } */ + if (0 <= x) return;/* { dg-warning "comparison of unsigned expression in '>= 0' is always true" } */ if (1U >= 0) return; if (1U < 0) return; if (0 <= 1U) return; @@ -42,18 +42,18 @@ void c (unsigned int x) void d (unsigned long x) { - if (x < 0) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */ - if (x >= 0) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */ - if (0 > x) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */ - if (0 <= x) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */ + if (x < 0) return;/* { dg-warning "comparison of unsigned expression in '< 0' is always false" } */ + if (x >= 0) return;/* { dg-warning "comparison of unsigned expression in '>= 0' is always true" } */ + if (0 > x) return;/* { dg-warning "comparison of unsigned expression in '< 0' is always false" } */ + if (0 <= x) return;/* { dg-warning "comparison of unsigned expression in '>= 0' is always true" } */ } void e (unsigned long long x) { - if (x < 0) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */ - if (x >= 0) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */ - if (0 > x) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */ - if (0 <= x) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */ + if (x < 0) return;/* { dg-warning "comparison of unsigned expression in '< 0' is always false" } */ + if (x >= 0) return;/* { dg-warning "comparison of unsigned expression in '>= 0' is always true" } */ + if (0 > x) return;/* { dg-warning "comparison of unsigned expression in '< 0' is always false" } */ + if (0 <= x) return;/* { dg-warning "comparison of unsigned expression in '>= 0' is always true" } */ } int test (int x) diff --git a/gcc/testsuite/g++.dg/warn/Wtype-limits.C b/gcc/testsuite/g++.dg/warn/Wtype-limits.C index 7919a42c834..6a968d953db 100644 --- a/gcc/testsuite/g++.dg/warn/Wtype-limits.C +++ b/gcc/testsuite/g++.dg/warn/Wtype-limits.C @@ -30,10 +30,10 @@ void b (unsigned short x) void c (unsigned int x) { - if (x < 0) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */ - if (x >= 0) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */ - if (0 > x) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */ - if (0 <= x) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */ + if (x < 0) return;/* { dg-warning "comparison of unsigned expression in '< 0' is always false" } */ + if (x >= 0) return;/* { dg-warning "comparison of unsigned expression in '>= 0' is always true" } */ + if (0 > x) return;/* { dg-warning "comparison of unsigned expression in '< 0' is always false" } */ + if (0 <= x) return;/* { dg-warning "comparison of unsigned expression in '>= 0' is always true" } */ if (1U >= 0) return; if (1U < 0) return; if (0 <= 1U) return; @@ -42,18 +42,18 @@ void c (unsigned int x) void d (unsigned long x) { - if (x < 0) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */ - if (x >= 0) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */ - if (0 > x) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */ - if (0 <= x) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */ + if (x < 0) return;/* { dg-warning "comparison of unsigned expression in '< 0' is always false" } */ + if (x >= 0) return;/* { dg-warning "comparison of unsigned expression in '>= 0' is always true" } */ + if (0 > x) return;/* { dg-warning "comparison of unsigned expression in '< 0' is always false" } */ + if (0 <= x) return;/* { dg-warning "comparison of unsigned expression in '>= 0' is always true" } */ } void e (unsigned long long x) { - if (x < 0) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */ - if (x >= 0) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */ - if (0 > x) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */ - if (0 <= x) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */ + if (x < 0) return;/* { dg-warning "comparison of unsigned expression in '< 0' is always false" } */ + if (x >= 0) return;/* { dg-warning "comparison of unsigned expression in '>= 0' is always true" } */ + if (0 > x) return;/* { dg-warning "comparison of unsigned expression in '< 0' is always false" } */ + if (0 <= x) return;/* { dg-warning "comparison of unsigned expression in '>= 0' is always true" } */ } int test (int x) diff --git a/gcc/testsuite/g++.dg/wrappers/pr88680.C b/gcc/testsuite/g++.dg/wrappers/pr88680.C index 1bd6292857d..8f8bdd6359e 100644 --- a/gcc/testsuite/g++.dg/wrappers/pr88680.C +++ b/gcc/testsuite/g++.dg/wrappers/pr88680.C @@ -27,9 +27,9 @@ void test(unsigned n) return; if (N >= FOO) return; - if (n >= 0) // { dg-warning ">= 0 is always true" } + if (n >= 0) // { dg-warning "'>= 0' is always true" } return; - if (n < 0) // { dg-warning "< 0 is always false" } + if (n < 0) // { dg-warning "'< 0' is always false" } return; if (n >= FOO) return; @@ -45,9 +45,9 @@ void test(unsigned n) return; if (0 <= FOO) return; - if (0 <= n) // { dg-warning ">= 0 is always true" } + if (0 <= n) // { dg-warning "'>= 0' is always true" } return; - if (0 > n) // { dg-warning "< 0 is always false" } + if (0 > n) // { dg-warning "'< 0' is always false" } return; if (N <= FOO) return; diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh55.C b/gcc/testsuite/g++.old-deja/g++.mike/eh55.C index af43f66b1ba..5835c963be6 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/eh55.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/eh55.C @@ -9,7 +9,7 @@ void my_terminate_handler() { } void throw_an_unexpected_exception() throw() { - throw 1; // { dg-warning "throw will always call terminate" "" { target c++17 } } + throw 1; // { dg-warning "'throw' will always call 'terminate'" "" { target c++17 } } } int main() { diff --git a/gcc/testsuite/gcc.dg/Wsign-compare-1.c b/gcc/testsuite/gcc.dg/Wsign-compare-1.c index be3bd2fcbd8..b40bc6c5fee 100644 --- a/gcc/testsuite/gcc.dg/Wsign-compare-1.c +++ b/gcc/testsuite/gcc.dg/Wsign-compare-1.c @@ -5,7 +5,7 @@ unsigned int f0 (int x, unsigned int y) { - return x ? y : -1; /* { dg-warning "18:operand of \\?: changes signedness from 'int' to 'unsigned int'" } */ + return x ? y : -1; /* { dg-warning "18:operand of '\\?:' changes signedness from 'int' to 'unsigned int'" } */ /* { dg-begin-multiline-output "" } return x ? y : -1; ^~ @@ -15,7 +15,7 @@ f0 (int x, unsigned int y) unsigned int f1 (int xxx, unsigned int yyy) { - return xxx ? yyy : -1; /* { dg-warning "22:operand of \\?: changes signedness from 'int' to 'unsigned int'" } */ + return xxx ? yyy : -1; /* { dg-warning "22:operand of '\\?:' changes signedness from 'int' to 'unsigned int'" } */ /* { dg-begin-multiline-output "" } return xxx ? yyy : -1; ^~ @@ -25,7 +25,7 @@ f1 (int xxx, unsigned int yyy) unsigned int f2 (int xxx, unsigned int yyy) { - return xxx ? -1 : yyy; /* { dg-warning "16:operand of \\?: changes signedness from 'int' to 'unsigned int'" } */ + return xxx ? -1 : yyy; /* { dg-warning "16:operand of '\\?:' changes signedness from 'int' to 'unsigned int'" } */ /* { dg-begin-multiline-output "" } return xxx ? -1 : yyy; ^~ @@ -35,7 +35,7 @@ f2 (int xxx, unsigned int yyy) unsigned int f3 (unsigned int yyy) { - return yyy ?: -1; /* { dg-warning "17:operand of \\?: changes signedness from 'int' to 'unsigned int'" } */ + return yyy ?: -1; /* { dg-warning "17:operand of '\\?:' changes signedness from 'int' to 'unsigned int'" } */ /* { dg-begin-multiline-output "" } return yyy ?: -1; ^~ @@ -45,7 +45,7 @@ f3 (unsigned int yyy) unsigned int f4 (int xxx, unsigned yyy, short uuu) { - return xxx ? yyy : uuu; /* { dg-warning "22:operand of \\?: changes signedness from 'short int' to 'unsigned int'" } */ + return xxx ? yyy : uuu; /* { dg-warning "22:operand of '\\?:' changes signedness from 'short int' to 'unsigned int'" } */ /* { dg-begin-multiline-output "" } return xxx ? yyy : uuu; ^~~ @@ -55,7 +55,7 @@ f4 (int xxx, unsigned yyy, short uuu) unsigned int f5 (int xxx, unsigned yyy, short uuu) { - return xxx ? uuu : yyy; /* { dg-warning "16:operand of \\?: changes signedness from 'short int' to 'unsigned int'" } */ + return xxx ? uuu : yyy; /* { dg-warning "16:operand of '\\?:' changes signedness from 'short int' to 'unsigned int'" } */ /* { dg-begin-multiline-output "" } return xxx ? uuu : yyy; ^~~ @@ -65,7 +65,7 @@ f5 (int xxx, unsigned yyy, short uuu) unsigned int f6 (int xxx, unsigned yyy, signed char uuu) { - return xxx ? yyy : uuu; /* { dg-warning "22:operand of \\?: changes signedness from 'signed char' to 'unsigned int'" } */ + return xxx ? yyy : uuu; /* { dg-warning "22:operand of '\\?:' changes signedness from 'signed char' to 'unsigned int'" } */ /* { dg-begin-multiline-output "" } return xxx ? yyy : uuu; ^~~ @@ -75,7 +75,7 @@ f6 (int xxx, unsigned yyy, signed char uuu) unsigned int f7 (int xxx, unsigned yyy, signed char uuu) { - return xxx ? uuu : yyy; /* { dg-warning "16:operand of \\?: changes signedness from 'signed char' to 'unsigned int'" } */ + return xxx ? uuu : yyy; /* { dg-warning "16:operand of '\\?:' changes signedness from 'signed char' to 'unsigned int'" } */ /* { dg-begin-multiline-output "" } return xxx ? uuu : yyy; ^~~ diff --git a/gcc/testsuite/gcc.dg/Wtype-limits-Wextra.c b/gcc/testsuite/gcc.dg/Wtype-limits-Wextra.c index e5e7f944476..d04ecb7f344 100644 --- a/gcc/testsuite/gcc.dg/Wtype-limits-Wextra.c +++ b/gcc/testsuite/gcc.dg/Wtype-limits-Wextra.c @@ -21,22 +21,22 @@ void a (unsigned char x) } void b (unsigned short x) -{ /* { dg-warning "comparison of unsigned expression < 0 is always false" "" { target { ! int32plus } } .+1 } */ +{ /* { dg-warning "comparison of unsigned expression '< 0' is always false" "" { target { ! int32plus } } .+1 } */ if (x < 0) return;/* { dg-warning "comparison is always false due to limited range of data type" "" { target { int32plus } } } */ - /* { dg-warning "comparison of unsigned expression >= 0 is always true" "" { target { ! int32plus } } .+1 } */ + /* { dg-warning "comparison of unsigned expression '>= 0' is always true" "" { target { ! int32plus } } .+1 } */ if (x >= 0) return;/* { dg-warning "comparison is always true due to limited range of data type" "" { target { int32plus } } } */ - /* { dg-warning "comparison of unsigned expression < 0 is always false" "" { target { ! int32plus } } .+1 } */ + /* { dg-warning "comparison of unsigned expression '< 0' is always false" "" { target { ! int32plus } } .+1 } */ if (0 > x) return;/* { dg-warning "comparison is always false due to limited range of data type" "" { target { int32plus } } } */ - /* { dg-warning "comparison of unsigned expression >= 0 is always true" "" { target { ! int32plus } } .+1 } */ + /* { dg-warning "comparison of unsigned expression '>= 0' is always true" "" { target { ! int32plus } } .+1 } */ if (0 <= x) return;/* { dg-warning "comparison is always true due to limited range of data type" "" { target { int32plus } } } */ } void c (unsigned int x) { - if (x < 0) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */ - if (x >= 0) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */ - if (0 > x) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */ - if (0 <= x) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */ + if (x < 0) return;/* { dg-warning "comparison of unsigned expression in '< 0' is always false" } */ + if (x >= 0) return;/* { dg-warning "comparison of unsigned expression in '>= 0' is always true" } */ + if (0 > x) return;/* { dg-warning "comparison of unsigned expression in '< 0' is always false" } */ + if (0 <= x) return;/* { dg-warning "comparison of unsigned expression in '>= 0' is always true" } */ if (1U >= 0) return; if (1U < 0) return; if (0 <= 1U) return; @@ -45,18 +45,18 @@ void c (unsigned int x) void d (unsigned long x) { - if (x < 0) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */ - if (x >= 0) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */ - if (0 > x) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */ - if (0 <= x) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */ + if (x < 0) return;/* { dg-warning "comparison of unsigned expression in '< 0' is always false" } */ + if (x >= 0) return;/* { dg-warning "comparison of unsigned expression in '>= 0' is always true" } */ + if (0 > x) return;/* { dg-warning "comparison of unsigned expression in '< 0' is always false" } */ + if (0 <= x) return;/* { dg-warning "comparison of unsigned expression in '>= 0' is always true" } */ } void e (unsigned long long x) { - if (x < 0) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */ - if (x >= 0) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */ - if (0 > x) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */ - if (0 <= x) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */ + if (x < 0) return;/* { dg-warning "comparison of unsigned expression in '< 0' is always false" } */ + if (x >= 0) return;/* { dg-warning "comparison of unsigned expression in '>= 0' is always true" } */ + if (0 > x) return;/* { dg-warning "comparison of unsigned expression in '< 0' is always false" } */ + if (0 <= x) return;/* { dg-warning "comparison of unsigned expression in '>= 0' is always true" } */ } int test (int x) diff --git a/gcc/testsuite/gcc.dg/Wtype-limits.c b/gcc/testsuite/gcc.dg/Wtype-limits.c index 2d6f9910d44..6a596fc3a3c 100644 --- a/gcc/testsuite/gcc.dg/Wtype-limits.c +++ b/gcc/testsuite/gcc.dg/Wtype-limits.c @@ -21,22 +21,22 @@ void a (unsigned char x) } void b (unsigned short x) -{ /* { dg-warning "comparison of unsigned expression < 0 is always false" "" { target { ! int32plus } } .+1 } */ +{ /* { dg-warning "comparison of unsigned expression in '< 0' is always false" "" { target { ! int32plus } } .+1 } */ if (x < 0) return;/* { dg-warning "comparison is always false due to limited range of data type" "" { target { int32plus } } } */ - /* { dg-warning "comparison of unsigned expression >= 0 is always true" "" { target { ! int32plus } } .+1 } */ + /* { dg-warning "comparison of unsigned expression in '>= 0' is always true" "" { target { ! int32plus } } .+1 } */ if (x >= 0) return;/* { dg-warning "comparison is always true due to limited range of data type" "" { target { int32plus } } } */ - /* { dg-warning "comparison of unsigned expression < 0 is always false" "" { target { ! int32plus } } .+1 } */ + /* { dg-warning "comparison of unsigned expression in '< 0' is always false" "" { target { ! int32plus } } .+1 } */ if (0 > x) return;/* { dg-warning "comparison is always false due to limited range of data type" "" { target { int32plus } } } */ - /* { dg-warning "comparison of unsigned expression >= 0 is always true" "" { target { ! int32plus } } .+1 } */ + /* { dg-warning "comparison of unsigned expression in '>= 0' is always true" "" { target { ! int32plus } } .+1 } */ if (0 <= x) return;/* { dg-warning "comparison is always true due to limited range of data type" "" { target { int32plus } } } */ } void c (unsigned int x) { - if (x < 0) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */ - if (x >= 0) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */ - if (0 > x) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */ - if (0 <= x) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */ + if (x < 0) return;/* { dg-warning "comparison of unsigned expression in '< 0' is always false" } */ + if (x >= 0) return;/* { dg-warning "comparison of unsigned expression in '>= 0' is always true" } */ + if (0 > x) return;/* { dg-warning "comparison of unsigned expression in '< 0' is always false" } */ + if (0 <= x) return;/* { dg-warning "comparison of unsigned expression in '>= 0' is always true" } */ if (1U >= 0) return; if (1U < 0) return; if (0 <= 1U) return; @@ -45,18 +45,18 @@ void c (unsigned int x) void d (unsigned long x) { - if (x < 0) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */ - if (x >= 0) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */ - if (0 > x) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */ - if (0 <= x) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */ + if (x < 0) return;/* { dg-warning "comparison of unsigned expression in '< 0' is always false" } */ + if (x >= 0) return;/* { dg-warning "comparison of unsigned expression in '>= 0' is always true" } */ + if (0 > x) return;/* { dg-warning "comparison of unsigned expression in '< 0' is always false" } */ + if (0 <= x) return;/* { dg-warning "comparison of unsigned expression in '>= 0' is always true" } */ } void e (unsigned long long x) { - if (x < 0) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */ - if (x >= 0) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */ - if (0 > x) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */ - if (0 <= x) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */ + if (x < 0) return;/* { dg-warning "comparison of unsigned expression in '< 0' is always false" } */ + if (x >= 0) return;/* { dg-warning "comparison of unsigned expression in '>= 0' is always true" } */ + if (0 > x) return;/* { dg-warning "comparison of unsigned expression in '< 0' is always false" } */ + if (0 <= x) return;/* { dg-warning "comparison of unsigned expression in '>= 0' is always true" } */ } int test (int x) diff --git a/gcc/testsuite/gcc.dg/Wunknownprag.c b/gcc/testsuite/gcc.dg/Wunknownprag.c index 3514825a97e..158cab71511 100644 --- a/gcc/testsuite/gcc.dg/Wunknownprag.c +++ b/gcc/testsuite/gcc.dg/Wunknownprag.c @@ -5,7 +5,7 @@ /* We used to get "unspellable token: CPP_EOF" warnings. */ -#pragma /* { dg-warning "-:ignoring #pragma" } */ -#pragma ~ /* { dg-warning "-:ignoring #pragma" } */ -#pragma baz /* { dg-warning "-:ignoring #pragma" } */ -#pragma baz baz /* { dg-warning "-:ignoring #pragma" } */ +#pragma /* { dg-warning "-:ignoring '#pragma" } */ +#pragma ~ /* { dg-warning "-:ignoring '#pragma" } */ +#pragma baz /* { dg-warning "-:ignoring '#pragma" } */ +#pragma baz baz /* { dg-warning "-:ignoring '#pragma baz baz'" } */ diff --git a/gcc/testsuite/gcc.dg/Wunsuffixed-float-constants-1.c b/gcc/testsuite/gcc.dg/Wunsuffixed-float-constants-1.c index b4a38d5cb10..ba992c45c03 100644 --- a/gcc/testsuite/gcc.dg/Wunsuffixed-float-constants-1.c +++ b/gcc/testsuite/gcc.dg/Wunsuffixed-float-constants-1.c @@ -8,8 +8,8 @@ double a = 1.1d; /* With FLOAT_CONST_DECIMAL64 switched to ON these would have type _Decimal64. */ -double b = VAL; /* { dg-warning "unsuffixed float constant" } */ -double c = 1.2; /* { dg-warning "unsuffixed float constant" } */ +double b = VAL; /* { dg-warning "unsuffixed floating constant" } */ +double c = 1.2; /* { dg-warning "unsuffixed floating constant" } */ /* With FLOAT_CONST_DECIMAL64 switched to ON these are still binary. */ diff --git a/gcc/testsuite/gcc.dg/asm-6.c b/gcc/testsuite/gcc.dg/asm-6.c index 9c0ac1eb27e..10983c77c55 100644 --- a/gcc/testsuite/gcc.dg/asm-6.c +++ b/gcc/testsuite/gcc.dg/asm-6.c @@ -2,6 +2,6 @@ void foo () { int i; - __asm__ ("" : [data] "=r" (i) : [data] "i" (100)); /* { dg-error "duplicate asm operand" } */ + __asm__ ("" : [data] "=r" (i) : [data] "i" (100)); /* { dg-error "duplicate 'asm' operand" } */ __asm__ ("%[foo]" :: [bar] "i" (1)); /* { dg-error "undefined named operand" } */ } diff --git a/gcc/testsuite/gcc.dg/asm-qual-1.c b/gcc/testsuite/gcc.dg/asm-qual-1.c index eff6b45d217..7278be84ac6 100644 --- a/gcc/testsuite/gcc.dg/asm-qual-1.c +++ b/gcc/testsuite/gcc.dg/asm-qual-1.c @@ -8,7 +8,7 @@ f (void) { asm volatile (""); - asm const (""); /* { dg-error {'const' is not an asm qualifier} } */ + asm const (""); /* { dg-error {'const' is not an 'asm' qualifier} } */ - asm restrict (""); /* { dg-error {'restrict' is not an asm qualifier} } */ + asm restrict (""); /* { dg-error {'restrict' is not an 'asm' qualifier} } */ } diff --git a/gcc/testsuite/gcc.dg/cast-1.c b/gcc/testsuite/gcc.dg/cast-1.c index 7b12ad9f561..19ed4f4208d 100644 --- a/gcc/testsuite/gcc.dg/cast-1.c +++ b/gcc/testsuite/gcc.dg/cast-1.c @@ -24,8 +24,8 @@ f (void) (union u) l; /* { dg-error "cast to union type from type not present in union" } */ (int) sv; /* { dg-error "aggregate value used where an integer was expected" } */ (int) uv; /* { dg-error "aggregate value used where an integer was expected" } */ - (float) sv; /* { dg-error "aggregate value used where a float was expected" } */ - (float) uv; /* { dg-error "aggregate value used where a float was expected" } */ + (float) sv; /* { dg-error "aggregate value used where a floating point was expected" } */ + (float) uv; /* { dg-error "aggregate value used where a floating point was expected" } */ (_Complex double) sv; /* { dg-error "aggregate value used where a complex was expected" } */ (_Complex double) uv; /* { dg-error "aggregate value used where a complex was expected" } */ (void *) sv; /* { dg-error "cannot convert to a pointer type" } */ diff --git a/gcc/testsuite/gcc.dg/cast-2.c b/gcc/testsuite/gcc.dg/cast-2.c index f7f58f8a41c..24f63b2e8d4 100644 --- a/gcc/testsuite/gcc.dg/cast-2.c +++ b/gcc/testsuite/gcc.dg/cast-2.c @@ -24,8 +24,8 @@ f (void) (union u) l; /* { dg-error "cast to union type from type not present in union" } */ (int) sv; /* { dg-error "aggregate value used where an integer was expected" } */ (int) uv; /* { dg-error "aggregate value used where an integer was expected" } */ - (float) sv; /* { dg-error "aggregate value used where a float was expected" } */ - (float) uv; /* { dg-error "aggregate value used where a float was expected" } */ + (float) sv; /* { dg-error "aggregate value used where a floating point was expected" } */ + (float) uv; /* { dg-error "aggregate value used where a floating point was expected" } */ (_Complex double) sv; /* { dg-error "aggregate value used where a complex was expected" } */ (_Complex double) uv; /* { dg-error "aggregate value used where a complex was expected" } */ (void *) sv; /* { dg-error "cannot convert to a pointer type" } */ diff --git a/gcc/testsuite/gcc.dg/cast-3.c b/gcc/testsuite/gcc.dg/cast-3.c index 40d3c88c680..d8ae3a0fce2 100644 --- a/gcc/testsuite/gcc.dg/cast-3.c +++ b/gcc/testsuite/gcc.dg/cast-3.c @@ -24,8 +24,8 @@ f (void) (union u) l; /* { dg-error "cast to union type from type not present in union" } */ (int) sv; /* { dg-error "aggregate value used where an integer was expected" } */ (int) uv; /* { dg-error "aggregate value used where an integer was expected" } */ - (float) sv; /* { dg-error "aggregate value used where a float was expected" } */ - (float) uv; /* { dg-error "aggregate value used where a float was expected" } */ + (float) sv; /* { dg-error "aggregate value used where a floating point was expected" } */ + (float) uv; /* { dg-error "aggregate value used where a floating point was expected" } */ (_Complex double) sv; /* { dg-error "aggregate value used where a complex was expected" } */ (_Complex double) uv; /* { dg-error "aggregate value used where a complex was expected" } */ (void *) sv; /* { dg-error "cannot convert to a pointer type" } */ diff --git a/gcc/testsuite/gcc.dg/cpp/source_date_epoch-2.c b/gcc/testsuite/gcc.dg/cpp/source_date_epoch-2.c index ae18362ae87..2ca8fa32d3e 100644 --- a/gcc/testsuite/gcc.dg/cpp/source_date_epoch-2.c +++ b/gcc/testsuite/gcc.dg/cpp/source_date_epoch-2.c @@ -6,7 +6,7 @@ int main(void) { - __builtin_printf ("%s %s\n", __DATE__, __TIME__); /* { dg-error "SOURCE_DATE_EPOCH must expand" } */ + __builtin_printf ("%s %s\n", __DATE__, __TIME__); /* { dg-error "environment variable 'SOURCE_DATE_EPOCH' must expand" } */ __builtin_printf ("%s %s\n", __DATE__, __TIME__); return 0; } diff --git a/gcc/testsuite/gcc.dg/debug/pr85252.c b/gcc/testsuite/gcc.dg/debug/pr85252.c index 6e5ca85bc86..9bd4d48d618 100644 --- a/gcc/testsuite/gcc.dg/debug/pr85252.c +++ b/gcc/testsuite/gcc.dg/debug/pr85252.c @@ -5,7 +5,7 @@ void foo (void) { static char a[0] = ""; - static char b[0] = "b"; /* { dg-warning "initializer-string for array of chars is too long" } */ + static char b[0] = "b"; /* { dg-warning "initializer-string for array of 'char' is too long" } */ static char c[1] = "c"; - static char d[1] = "de"; /* { dg-warning "initializer-string for array of chars is too long" } */ + static char d[1] = "de"; /* { dg-warning "initializer-string for array of 'char' is too long" } */ } diff --git a/gcc/testsuite/gcc.dg/dfp/cast-bad.c b/gcc/testsuite/gcc.dg/dfp/cast-bad.c index e9e31ff3067..8d22ba3f8c1 100644 --- a/gcc/testsuite/gcc.dg/dfp/cast-bad.c +++ b/gcc/testsuite/gcc.dg/dfp/cast-bad.c @@ -31,10 +31,10 @@ f (void) (struct s) d128; /* { dg-error "conversion to non-scalar type requested" } */ (union u) d128; /* { dg-error "cast to union type from type not present in union" } */ - (_Decimal32) sv; /* { dg-error "aggregate value used where a float was expected" } */ - (_Decimal32) uv; /* { dg-error "aggregate value used where a float was expected" } */ - (_Decimal64) sv; /* { dg-error "aggregate value used where a float was expected" } */ - (_Decimal64) uv; /* { dg-error "aggregate value used where a float was expected" } */ - (_Decimal128) sv; /* { dg-error "aggregate value used where a float was expected" } */ - (_Decimal128) uv; /* { dg-error "aggregate value used where a float was expected" } */ + (_Decimal32) sv; /* { dg-error "aggregate value used where a floating point was expected" } */ + (_Decimal32) uv; /* { dg-error "aggregate value used where a floating point was expected" } */ + (_Decimal64) sv; /* { dg-error "aggregate value used where a floating point was expected" } */ + (_Decimal64) uv; /* { dg-error "aggregate value used where a floating point was expected" } */ + (_Decimal128) sv; /* { dg-error "aggregate value used where a floating point was expected" } */ + (_Decimal128) uv; /* { dg-error "aggregate value used where a floating point was expected" } */ } diff --git a/gcc/testsuite/gcc.dg/format/gcc_diag-1.c b/gcc/testsuite/gcc.dg/format/gcc_diag-1.c index 87614567b91..4a64d5460c6 100644 --- a/gcc/testsuite/gcc.dg/format/gcc_diag-1.c +++ b/gcc/testsuite/gcc.dg/format/gcc_diag-1.c @@ -1,7 +1,7 @@ /* Test for GCC diagnostic formats. */ /* Origin: Kaveh Ghazi */ /* { dg-do compile } */ -/* { dg-options "-Wformat" } */ +/* { dg-options "-Wformat -Wno-format-diag" } */ #include "format.h" diff --git a/gcc/testsuite/gcc.dg/format/gcc_diag-11.c b/gcc/testsuite/gcc.dg/format/gcc_diag-11.c new file mode 100644 index 00000000000..a716c8de7ef --- /dev/null +++ b/gcc/testsuite/gcc.dg/format/gcc_diag-11.c @@ -0,0 +1,382 @@ +/* Test warnings for for GCC diagnostics. + { dg-do compile } + { dg-options "-Wformat -Wformat-diag" } */ + +/* Magic identifiers must be set before the attribute is used. */ + +typedef long long __gcc_host_wide_int__; + +typedef struct location_s +{ + const char *file; + int line; +} location_t; + +union tree_node; +typedef union tree_node *tree; + +/* Define gimple as a dummy type. The typedef must be provided for + the C test to find the symbol. */ +typedef struct gimple gimple; + +/* Likewise for gimple. */ +typedef struct cgraph_node cgraph_node; + +#define FORMAT(kind) __attribute__ ((format (__gcc_## kind ##__, 1, 2))) + +/* Basic formatting function like pp_format. */ +void diag (const char*, ...) FORMAT (diag); + +/* Diagnostic formatting function like error or warning declared + by the C front end. */ +void cdiag (const char*, ...) FORMAT (cdiag); + +/* Diagnostic formatting function like error or warning declared + by the middle-end or back-end. */ +void tdiag (const char*, ...) FORMAT (tdiag); + +/* Diagnostic formatting function like error or warning declared + by the C++ front-end. */ +void cxxdiag (const char*, ...) FORMAT (cxxdiag); + +void dump (const char*, ...) FORMAT (dump_printf); + +/* Verify that functions declared with the C/C++ front-end __gcc_cdiag__ + attribute detect invalid whitespace in format strings. */ + +void test_cdiag_whitespace (tree t, gimple *gc) +{ + (void)&t; (void)&gc; + + /* Verify that strings of leading spaces don't trigger a warning. */ + cdiag (" a"); + cdiag (" b"); + cdiag (" c"); + cdiag ("%< %>a"); + cdiag ("%< %>a"); + cdiag ("a b"); + cdiag ("a b"); /* { dg-warning "unquoted sequence of 2 consecutive space characters" } */ + cdiag ("a "); /* { dg-warning "spurious trailing space character" } */ + cdiag ("a "); /* { dg-warning "spurious trailing space characters" } */ + cdiag ("a%< %>"); + cdiag ("a%< %>%< %>"); + cdiag ("a%< %> "); /* { dg-warning "spurious trailing space character" } */ + cdiag ("a%< %> %< %>"); /* { dg-warning "unquoted sequence of 2 consecutive space characters" } */ + + /* It's debatable whether the following two formst strings should + be cdiagnosed. They aren't only because it's simpler that way. */ + cdiag ("a %< %>"); + cdiag ("a%< %> %< %>"); + + /* Exercise other whitespace characters. */ + cdiag ("a\fb"); /* { dg-warning "unquoted whitespace character '\\\\x0c'" } */ + cdiag ("a\nb"); /* { dg-warning "unquoted whitespace character '\\\\x0a'" } */ + cdiag ("a\rb"); /* { dg-warning "unquoted whitespace character '\\\\x0d'" } */ + cdiag ("a\vb"); /* { dg-warning "unquoted whitespace character '\\\\x0b'" } */ + + cdiag ("First sentence. And a next."); + cdiag ("First sentence. not capitalized sentence"); /* { dg-warning "inconsistent capitalization" } */ + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-diag" + + /* Verify that the warning can be suppressed. */ + cdiag ("\ta\b c\vb\n"); + +#pragma GCC diagnostic pop +} + + +void test_cdiag_control (tree t, gimple *gc) +{ + (void)&t; (void)&gc; + + cdiag ("\1"); /* { dg-warning "unquoted control character '\\\\x01'" } */ + cdiag ("a\ab"); /* { dg-warning "unquoted control character '\\\\x07'" } */ + cdiag ("a\bb"); /* { dg-warning "unquoted control character '\\\\x08'" } */ +} + + +void test_cdiag_punct (tree t, gimple *gc, int i) +{ + (void)&t; (void)&gc; + + /* Exercise the period. */ + cdiag (".abc"); /* { dg-warning "spurious leading punctuation character" } */ + cdiag ("abc;"); /* { dg-warning "spurious trailing punctuation character" } */ + /* Verify that sentences that start with an uppercase letter and end + in a period are not diagnosed. */ + cdiag ("This is a full sentence."); + cdiag ("Capitalized sentence (with a parethetical note)."); + cdiag ("Not a full sentence;"); /* { dg-warning "spurious trailing punctuation character" } */ + cdiag ("Neither is this one,"); /* { dg-warning "spurious trailing punctuation character" } */ + + /* Exercise the ellipsis. */ + cdiag ("this message..."); + cdiag ("...continues here"); + cdiag ("but...not here"); /* { dg-warning "unquoted sequence of 3 consecutive punctuation characters" } */ + + /* Verify that parenthesized sentences are accepted, even the whole + meesage (done in the C++ front end). */ + cdiag ("null argument where non-null required (argument %i)", i); + cdiag ("null (argument %i) where non-null required", i); + cdiag ("(see what comes next)"); + + /* Verify that only a single trailing colon is accepted. */ + cdiag ("candidates are:"); + cdiag ("candidates are::"); /* { dg-warning "spurious trailing punctuation characters" } */ + + /* Exercise C++. */ + cdiag ("C++ is cool"); + cdiag ("this is c++"); + cdiag ("you can do this in C++ but not in C"); + + /* Also verify that G++ is accepted. */ + cdiag ("G++ rocks"); + cdiag ("this is accepted by g++"); + cdiag ("valid in G++ (or g++) but not in gcc"); + + /* Exercise parenthetical note followed by a colon, semicolon, + or a comma. */ + cdiag ("found a bug (here):"); + cdiag ("because of another bug (over there); fix it"); + + cdiag ("found foo (123): go look at it"); + cdiag ("missed bar (abc); will try harder next time"); + + cdiag ("expected this (or that), got something else (or who knows what)"); + + /* Exercise parenthetical note with a question mark. */ + cdiag ("hmmm (did you really mean that?)"); + cdiag ("error (did you mean %?)"); + /* And a question mark after a parenthetical note. */ + cdiag ("did you mean this (or that)?"); + + /* But make sure unbalanced parenthese are diagnosed. */ + cdiag ("or this or the other)?"); /* { dg-warning "unbalanced punctuation character '\\\)'" } */ + + cdiag ("## Heading"); /* { dg-warning "spurious leading punctuation characters '##'" } */ + cdiag ("## %s ##", "1"); /* { dg-warning "spurious (leading|trailing) punctuation characters '##'" } */ + + cdiag ("#1 priority"); /* { dg-warning "spurious leading punctuation character '#'" } */ + cdiag ("priority #2"); + + /* Quoting. */ + cdiag ("\"quoted\""); + cdiag ("\"quoted\" string"); + cdiag ("this is a \"string in quotes\""); + cdiag ("\"missing closing quote"); /* { dg-warning "unterminated quote character '\"'" } */ + + /* PR translation/90121 - punctuation character after a space. */ + cdiag ("bad version : 1"); /* { dg-warning "space followed by punctuation character ':'" } */ + cdiag ("problem ; fix it"); /* { dg-warning "space followed by punctuation character ';'" } */ + cdiag ("End . not."); /* { dg-warning "space followed by punctuation character '.'" } */ + cdiag ("it is bad , very bad"); /* { dg-warning "space followed by punctuation character ','" } */ + cdiag ("say what ?"); /* { dg-warning "space followed by punctuation character '?'" } */ + /* But these are okay after a space. */ + cdiag ("1 / 2"); + cdiag ("2 + 3"); + cdiag ("2 + 3"); +} + +void test_cdiag_punct_balance (tree t, gimple *gc) +{ + (void)&t; (void)&gc; + + cdiag ("f()"); /* { dg-warning "spurious trailing punctuation characters" } */ + cdiag ("g(1)"); + cdiag ("("); /* { dg-warning "spurious leading punctuation character|unbalanced" } */ + cdiag ("()"); /* { dg-warning "spurious leading punctuation characters" } */ + cdiag (")"); /* { dg-warning "unbalanced punctuation character '\\\)'" } */ + cdiag ("f()g"); /* { dg-warning "unquoted sequence of 2 consecutive punctuation characters" } */ + cdiag ("illegal operand (1)"); +} + + +void test_cdiag_nongraph (tree t, gimple *gc) +{ + (void)&t; (void)&gc; + + cdiag ("a\376b"); /* { dg-warning "unquoted non-graph character '\\\\xfe'" } */ + cdiag ("a\377b"); /* { dg-warning "unquoted non-graph character '\\\\xff'" } */ +} + + +void test_cdiag_attribute (tree t, gimple *gc) +{ + (void)&t; (void)&gc; + + cdiag ("attribute foo"); + cdiag ("this is attribute bar"); + cdiag ("bad __attribute bar"); /* { dg-warning "unquoted attribute" } */ + cdiag ("__attribute__ (foobar) bad"); /* { dg-warning "unquoted attribute" } */ + cdiag ("__attribute__ ((foobar))"); /* { dg-warning "unquoted attribute" } */ + cdiag ("__attribute__ (xxx))"); /* { dg-warning "unquoted attribute" } */ + /* { dg-warning "unbalanced punctuation character '\\\)'" "xxx" { target *-*-* } .-1 } */ + cdiag ("__attribute__ ((yyy)))"); /* { dg-warning "unquoted attribute" } */ + /* { dg-warning "unbalanced punctuation character '\\\)'" "yyy" { target *-*-* } .-1 } */ + cdiag ("__attribute__ ((zzz)"); /* { dg-warning "unquoted attribute" } */ + /* { dg-warning "unbalanced punctuation character '\\\('" "zzz" { target *-*-* } .-1 } */ + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-diag" + + /* Verify that the warning can be suppressed. */ + cdiag ("__attribute__ ((("); + +#pragma GCC diagnostic pop +} + +void test_cdiag_builtin (tree t, gimple *gc) +{ + (void)&t; (void)&gc; + + cdiag ("__builtin_abort"); /* { dg-warning "unquoted name of built-in function '__builtin_abort'" } */ + cdiag ("in __builtin_trap"); /* { dg-warning "unquoted name of built-in function '__builtin_trap'" } */ + cdiag ("__builtin_xyz bites");/* { dg-warning "unquoted name of built-in function '__builtin_xyz'" } */ + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-diag" + + /* Verify that the warning can be suppressed. */ + cdiag ("__builtin____with____lots__of__underscores"); + +#pragma GCC diagnostic pop +} + + +void test_cdiag_option (tree t, gimple *gc) +{ + (void)&t; (void)&gc; + + cdiag ("%<-Wall%>"); + cdiag ("use option %<-Wextra%> to enable additinal warnings"); + + cdiag ("-O2 is fast"); /* { dg-warning "unquoted option name '-O2'" } */ + cdiag ("but -O3 is faster"); /* { dg-warning "unquoted option name '-O3'" } */ + + cdiag ("get --help"); /* { dg-warning "unquoted option name '--help'" } */ + cdiag ("enable -m32"); /* { dg-warning "unquoted option name '-m32'" } */ + cdiag ("value is -12"); + cdiag ("foo-O2"); + cdiag ("a-W"); +} + + +void test_cdiag_keyword (tree t, gimple *gc) +{ + cdiag ("malignofer or alignofus"); + cdiag ("use alignof"); /* { dg-warning "unquoted keyword 'alignof'" } */ + cdiag ("or _Alignof"); /* { dg-warning " keyword '_Alignof'" } */ + cdiag ("_Pragma too"); /* { dg-warning " keyword '_Pragma'" } */ + + cdiag ("a #error directive"); /* { dg-warning "unquoted preprocessing directive '#error'" } */ + cdiag ("#include file"); /* { dg-warning "unquoted preprocessing directive '#include'" } */ + cdiag ("but #pragma foobar"); /* { dg-warning "unquoted preprocessing directive '#pragma'" } */ + cdiag ("pragma foobar is okay"); + cdiag ("or even # pragma is fine"); + + cdiag ("an offsetof here"); /* { dg-warning "unquoted keyword 'offsetof" } */ + cdiag ("sizeof x"); /* { dg-warning "unquoted keyword 'sizeof" } */ + cdiag ("have typeof"); /* { dg-warning "unquoted keyword 'typeof" } */ +} + + +void test_cdiag_operator (tree t, gimple *gc) +{ + cdiag ("a == b"); /* { dg-warning "unquoted operator '=='" } */ + cdiag ("++a"); /* { dg-warning "unquoted operator '\\\+\\\+'" } */ + cdiag ("b--"); /* { dg-warning "unquoted operator '--'" } */ +} + + +void test_cdiag_type_name (tree t, gimple *gc) +{ + cdiag ("the word character should not be quoted"); + cdiag ("but char should be"); /* { dg-warning "unquoted keyword 'char'" } */ + + cdiag ("unsigned char should be quoted"); /* { dg-warning "unquoted type name 'unsigned char'" } */ + cdiag ("but unsigned character is fine"); + + cdiag ("as should int"); /* { dg-warning "unquoted keyword 'int'" } */ + cdiag ("and signed int"); /* { dg-warning "unquoted type name 'signed int'" } */ + cdiag ("and also unsigned int"); /* { dg-warning "unquoted type name 'unsigned int'" } */ + cdiag ("very long thing"); + cdiag ("use long long here"); /* { dg-warning "unquoted type name 'long long'" } */ + + cdiag ("have a floating type"); + cdiag ("found float type"); /* { dg-warning "unquoted keyword 'float'" } */ + + cdiag ("break rules"); + cdiag ("if we continue by default for a short while else do nothing"); + cdiag ("register a function for unsigned extern to void const reads"); + cdiag ("or volatile access"); +} + + +void test_cdiag_identifier (tree t, gimple *gc) +{ + (void)&t; (void)&gc; + + cdiag ("private _x ident"); /* { dg-warning "unquoted identifier or keyword '_x'" } */ + cdiag ("and another __y"); /* { dg-warning "unquoted identifier or keyword '__y'" } */ + cdiag ("ident z_ with trailing underscore"); /* { dg-warning "unquoted identifier or keyword 'z_'" } */ + cdiag ("v_ variable"); /* { dg-warning "unquoted identifier or keyword 'v_'" } */ + cdiag ("call foo_bar"); /* { dg-warning "unquoted identifier or keyword 'foo_bar'" } */ + cdiag ("unqoted x_y ident"); /* { dg-warning "unquoted identifier or keyword 'x_y'" } */ + + cdiag ("size_t type"); /* { dg-warning "unquoted identifier or keyword 'size_t'" } */ + cdiag ("bigger than INT_MAX");/* { dg-warning "unquoted identifier or keyword 'INT_MAX'" } */ + + cdiag ("quoted ident %"); + cdiag ("another quoted identifier % here"); +} + + +void test_cdiag_bad_words (tree t, gimple *gc) +{ + (void)&t; (void)&gc; + + cdiag ("arn't you dumb?"); /* { dg-warning "bare apostrophe ''' in format" } */ + cdiag ("you can't do that"); /* { dg-warning "contraction 'can't' in format" } */ + cdiag ("you can%'t do that");/* { dg-warning "contraction 'can%'t' in format" "FIXME" { xfail *-*-* } } */ + cdiag ("it mustn't be"); /* { dg-warning "contraction 'mustn't' in format" } */ + cdiag ("isn't that silly?"); /* { dg-warning "bare apostrophe ''' in format" } */ + + cdiag ("can not do this"); /* { dg-warning "'can not' is not a word; use 'cannot' instead" } */ + cdiag ("you can not"); /* { dg-warning "'can not' is not a word; use 'cannot' instead" } */ + + /* See PR target/90157 - aarch64: unnecessary abbreviation in diagnostic */ + cdiag ("arg 1"); /* { dg-warning "'arg' is not a word; use 'argument' instead" } */ + cdiag ("bad arg"); /* { dg-warning "'arg' is not a word; use 'argument' instead" } */ + cdiag ("two args"); /* { dg-warning "'args' is not a word; use 'arguments' instead" } */ + cdiag ("args 1 and 2"); /* { dg-warning "'args' is not a word; use 'arguments' instead" } */ + + cdiag ("reg A"); /* { dg-warning "'reg' is not a word; use 'register' instead" } */ + cdiag ("regs A and B"); /* { dg-warning "'regs' is not a word; use 'registers' instead" } */ + cdiag ("no regs"); /* { dg-warning "'regs' is not a word; use 'registers' instead" } */ +} + + +void test_cdiag_directive (tree t, gimple *gc) +{ + (void)&t; (void)&gc; + + cxxdiag ("%<%s%>", ""); /* { dg-warning "quoted '%s' directive in format" } */ + /* This was asked to be diagnosed in PR #90158 but there, the \"%s\" + is in parenheses which ends up getting diagnosed because of + the two consecutive punctuation characters, ( and ". */ + cdiag ("\"%s\"", ""); /* { dg-warning "quoted '%s' directive in format" } */ + + /* Make sure quoted paired tokens are not diagnosed. */ + cdiag ("%<'%>"); + cdiag ("%<\"%>"); + cdiag ("%<<%>"); + cdiag ("%<>%>"); + cdiag ("%<(%>"); + cdiag ("%<)%>"); + cdiag ("%<[%>"); + cdiag ("%<]%>"); + + cdiag ("%<'%> %<\"%> %<>%> %<<%> %<)%> %<(%> %<]%> %<[%>"); +} diff --git a/gcc/testsuite/gcc.dg/gcc_diag-11.c b/gcc/testsuite/gcc.dg/gcc_diag-11.c new file mode 100644 index 00000000000..c359989f481 --- /dev/null +++ b/gcc/testsuite/gcc.dg/gcc_diag-11.c @@ -0,0 +1,220 @@ +/* Test warnings for for GCC diagnostics. + { dg-do compile } + { dg-options "-Wformat -Wformat-diag" } */ + +/* Magic identifiers must be set before the attribute is used. */ + +typedef long long __gcc_host_wide_int__; + +typedef struct location_s +{ + const char *file; + int line; +} location_t; + +union tree_node; +typedef union tree_node *tree; + +/* Define gimple as a dummy type. The typedef must be provided for + the C test to find the symbol. */ +typedef struct gimple gimple; + +/* Likewise for gimple. */ +typedef struct cgraph_node cgraph_node; + +#define FORMAT(kind) __attribute__ ((format (__gcc_## kind ##__, 1, 2))) + +/* Basic formatting function like pp_format. */ +void diag (const char*, ...) FORMAT (diag); + +/* Diagnostic formatting function like error or warning declared + by the C front end. */ +void cdiag (const char*, ...) FORMAT (cdiag); + +/* Diagnostic formatting function like error or warning declared + by the middle-end or back-end. */ +void tdiag (const char*, ...) FORMAT (tdiag); + +/* Diagnostic formatting function like error or warning declared + by the C++ front-end. */ +void cxxdiag (const char*, ...) FORMAT (cxxdiag); + +void dump (const char*, ...) FORMAT (dump_printf); + +/* Verify that functions declared with the C/C++ front-end __gcc_cdiag__ + attribute detect invalid whitespace in format strings. */ + +void test_cdiag_whitespace (tree t, gimple *gc) +{ + (void)&t; (void)&gc; + + cdiag (" a"); /* { dg-warning "spurious leading space character in format" } */ + cdiag ("%< %>a"); + cdiag ("%< %>a"); + cdiag ("a b"); + cdiag ("a b"); /* { dg-warning "unquoted sequence of 2 consecutive space characters" } */ + cdiag ("a "); /* { dg-warning "spurious trailing space character" } */ + cdiag ("a "); /* { dg-warning "spurious trailing space characters" } */ + cdiag ("a%< %>"); + cdiag ("a%< %>%< %>"); + cdiag ("a%< %> "); /* { dg-warning "spurious trailing space character" } */ + cdiag ("a%< %> %< %>"); /* { dg-warning "unquoted sequence of 2 consecutive space characters" } */ + + /* It's debatable whether the following two formst strings should + be cdiagnosed. They aren't only because it's simpler that way. */ + cdiag ("a %< %>"); + cdiag ("a%< %> %< %>"); + + /* Exercise other whitespace characters. */ + cdiag ("a\fb"); /* { dg-warning "unquoted whitespace character '\\\\x0c'" } */ + cdiag ("a\nb"); /* { dg-warning "unquoted whitespace character '\\\\x0a'" } */ + cdiag ("a\rb"); /* { dg-warning "unquoted whitespace character '\\\\x0d'" } */ + cdiag ("a\vb"); /* { dg-warning "unquoted whitespace character '\\\\x0b'" } */ + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-diag" + + /* Verify that the warning can be suppressed. */ + cdiag ("\ta\b c\vb\n"); + +#pragma GCC diagnostic pop +} + + +void test_cdiag_control (tree t, gimple *gc) +{ + (void)&t; (void)&gc; + + cdiag ("\1"); /* { dg-warning "unquoted control character '\\\\x01'" } */ + cdiag ("a\ab"); /* { dg-warning "unquoted control character '\\\\x07'" } */ + cdiag ("a\bb"); /* { dg-warning "unquoted control character '\\\\x08'" } */ +} + + +void test_cdiag_punct (tree t, gimple *gc, int i) +{ + (void)&t; (void)&gc; + + /* Exercise the period. */ + cdiag (".abc"); /* { dg-warning "spurious leading punctuation character" } */ + cdiag ("abc;"); /* { dg-warning "spurious trailing punctuation character" } */ + /* Verify that sentences that start with an uppercase letter and end + in a period are not diagnosed. */ + cdiag ("This is a full sentence."); + cdiag ("Capitalized sentence (with a parethetical note)."); + cdiag ("Not a full sentence;"); /* { dg-warning "spurious trailing punctuation character" } */ + cdiag ("Neither is this one,"); /* { dg-warning "spurious trailing punctuation character" } */ + + /* Exercise the ellipsis. */ + cdiag ("this message..."); + cdiag ("...continues here"); + cdiag ("but...not here"); /* { dg-warning "unquoted sequence of 3 consecutive punctuation characters" } */ + + /* Exercise parentheses. */ + cdiag ("null argument where non-null required (argument %i)", i); + + /* Exercise C++. */ + cdiag ("C++ is cool"); + cdiag ("this is c++"); + cdiag ("you can do this in C++ but not in C"); + + /* Exercise parenthetical note followed by a colon, semicolon, + or a comma. */ + cdiag ("found a bug (here):"); + cdiag ("because of another bug (over there); fix it"); + + cdiag ("found foo (123): go look at it"); + cdiag ("missed bar (abc); will try harder next time"); + + cdiag ("expected this (or that), got something else (or who knows what)"); +} + + +void test_cdiag_punct_balance (tree t, gimple *gc) +{ + (void)&t; (void)&gc; + + cdiag ("f()"); /* { dg-warning "spurious trailing punctuation characters" } */ + cdiag ("g(1)"); + cdiag ("("); /* { dg-warning "spurious leading punctuation character|unbalanced" } */ + cdiag ("()"); /* { dg-warning "spurious leading punctuation characters" } */ + cdiag (")"); /* { dg-warning "unbalanced punctuation character '\\\)'" } */ + cdiag ("f()g"); /* { dg-warning "unquoted sequence of 2 consecutive punctuation characters" } */ + cdiag ("illegal operand (1)"); +} + + +void test_cdiag_nongraph (tree t, gimple *gc) +{ + (void)&t; (void)&gc; + + cdiag ("a\376b"); /* { dg-warning "unquoted non-graph character '\\\\xfe'" } */ + cdiag ("a\377b"); /* { dg-warning "unquoted non-graph character '\\\\xff'" } */ +} + + +void test_cdiag_attribute (tree t, gimple *gc) +{ + (void)&t; (void)&gc; + + cdiag ("attribute foo"); + cdiag ("this is attribute bar"); + cdiag ("bad __attribute bar"); /* { dg-warning "unquoted attribute" } */ + cdiag ("__attribute__ (foobar) bad"); /* { dg-warning "unquoted attribute" } */ + cdiag ("__attribute__ ((foobar))"); /* { dg-warning "unquoted attribute" } */ + cdiag ("__attribute__ (xxx))"); /* { dg-warning "unquoted attribute" } */ + /* { dg-warning "unbalanced punctuation character '\\\)'" "xxx" { target *-*-* } .-1 } */ + cdiag ("__attribute__ ((yyy)))"); /* { dg-warning "unquoted attribute" } */ + /* { dg-warning "unbalanced punctuation character '\\\)'" "yyy" { target *-*-* } .-1 } */ + cdiag ("__attribute__ ((zzz)"); /* { dg-warning "unquoted attribute" } */ + /* { dg-warning "unbalanced punctuation character '\\\('" "zzz" { target *-*-* } .-1 } */ + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-diag" + + /* Verify that the warning can be suppressed. */ + cdiag ("__attribute__ ((("); + +#pragma GCC diagnostic pop +} + +void test_cdiag_builtin (tree t, gimple *gc) +{ + (void)&t; (void)&gc; + + cdiag ("__builtin_abort"); /* { dg-warning "unquoted name of built-in function '__builtin_abort'" } */ + cdiag ("in __builtin_trap"); /* { dg-warning "unquoted name of built-in function '__builtin_trap'" } */ + cdiag ("__builtin_xyz bites");/* { dg-warning "unquoted name of built-in function '__builtin_xyz'" } */ + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-diag" + + /* Verify that the warning can be suppressed. */ + cdiag ("__builtin____with____lots__of__underscores"); + +#pragma GCC diagnostic pop +} + +void test_cdiag_option (tree t, gimple *gc) +{ + (void)&t; (void)&gc; + + cdiag ("%<-Wall%>"); + cdiag ("use option %<-Wextra%> to enable additinal warnings"); + + cdiag ("-O2 is fast"); /* { dg-warning "unquoted option name '-O2'" } */ + cdiag ("but -O3 is faster"); /* { dg-warning "unquoted option name '-O3'" } */ + + cdiag ("get --help"); /* { dg-warning "unquoted option name '--help'" } */ + cdiag ("enable -m32"); /* { dg-warning "unquoted option name '-m32'" } */ + cdiag ("value is -12"); + cdiag ("foo-O2"); + cdiag ("a-W"); +} + +void test_cdiag_oper (tree t, gimple *gc) +{ + cdiag ("a == b"); /* { dg-warning "unquoted operator '=='" } */ + cdiag ("++a"); /* { dg-warning "unquoted operator '\\\+\\\+'" } */ + cdiag ("b--"); /* { dg-warning "unquoted operator '--'" } */ +} diff --git a/gcc/testsuite/gcc.dg/gnu-cond-expr-2.c b/gcc/testsuite/gcc.dg/gnu-cond-expr-2.c index 2e561e4b1de..fed5adf15b7 100644 --- a/gcc/testsuite/gcc.dg/gnu-cond-expr-2.c +++ b/gcc/testsuite/gcc.dg/gnu-cond-expr-2.c @@ -9,5 +9,5 @@ int a, b, c; void f (void) { - c = (++a ? : b); /* { dg-warning "ISO C forbids omitting the middle term of a \\?: expression" } */ + c = (++a ? : b); /* { dg-warning "ISO C forbids omitting the middle term of a '\\?:' expression" } */ } diff --git a/gcc/testsuite/gcc.dg/gnu-cond-expr-3.c b/gcc/testsuite/gcc.dg/gnu-cond-expr-3.c index 90555ad63f5..08657ff737e 100644 --- a/gcc/testsuite/gcc.dg/gnu-cond-expr-3.c +++ b/gcc/testsuite/gcc.dg/gnu-cond-expr-3.c @@ -9,5 +9,5 @@ int a, b, c; void f (void) { - c = (++a ? : b); /* { dg-error "ISO C forbids omitting the middle term of a \\?: expression" } */ + c = (++a ? : b); /* { dg-error "ISO C forbids omitting the middle term of a '\\?:' expression" } */ } diff --git a/gcc/testsuite/gcc.dg/gomp/macro-4.c b/gcc/testsuite/gcc.dg/gomp/macro-4.c index 28d198b1ce3..a4ed9a3980a 100644 --- a/gcc/testsuite/gcc.dg/gomp/macro-4.c +++ b/gcc/testsuite/gcc.dg/gomp/macro-4.c @@ -10,9 +10,9 @@ void bar (void); void foo (void) { -#pragma omp p /* { dg-warning "-:ignoring #pragma omp _Pragma" } */ +#pragma omp p /* { dg-warning "-:ignoring '#pragma omp _Pragma'" } */ bar (); - omp_p /* { dg-warning "-:ignoring #pragma omp _Pragma" } */ + omp_p /* { dg-warning "-:ignoring '#pragma omp _Pragma'" } */ bar (); } @@ -22,8 +22,8 @@ foo (void) void baz (void) { -#pragma omp parallel /* { dg-warning "-:ignoring #pragma omp serial" } */ +#pragma omp parallel /* { dg-warning "-:ignoring '#pragma omp serial'" } */ bar (); - omp_parallel /* { dg-warning "-:ignoring #pragma omp serial" } */ + omp_parallel /* { dg-warning "-:ignoring '#pragma omp serial'" } */ bar (); } diff --git a/gcc/testsuite/gcc.dg/init-bad-1.c b/gcc/testsuite/gcc.dg/init-bad-1.c index a7e8c5a80a2..61734045f2b 100644 --- a/gcc/testsuite/gcc.dg/init-bad-1.c +++ b/gcc/testsuite/gcc.dg/init-bad-1.c @@ -16,9 +16,9 @@ void h(a) char s[1] = "x"; char s1[1] = { "x" }; -char t[1] = "xy"; /* { dg-warning "initializer-string for array of chars is too long" } */ -char t1[1] = { "xy" }; /* { dg-warning "initializer-string for array of chars is too long" } */ -char u[1] = { "x", "x" }; /* { dg-error "excess elements in char array initializer" } */ +char t[1] = "xy"; /* { dg-warning "initializer-string for array of 'char' is too long" } */ +char t1[1] = { "xy" }; /* { dg-warning "initializer-string for array of 'char' is too long" } */ +char u[1] = { "x", "x" }; /* { dg-error "excess elements in 'char' array initializer" } */ /* { dg-message "near init" "near" { target *-*-* } .-1 } */ int i = { }; /* { dg-error "empty scalar initializer" } */ diff --git a/gcc/testsuite/gcc.dg/init-bad-2.c b/gcc/testsuite/gcc.dg/init-bad-2.c index dad57b92baa..4775c4807bb 100644 --- a/gcc/testsuite/gcc.dg/init-bad-2.c +++ b/gcc/testsuite/gcc.dg/init-bad-2.c @@ -17,9 +17,9 @@ void h(a) char s[1] = "x"; char s1[1] = { "x" }; -char t[1] = "xy"; /* { dg-warning "initializer-string for array of chars is too long" } */ -char t1[1] = { "xy" }; /* { dg-warning "initializer-string for array of chars is too long" } */ -char u[1] = { "x", "x" }; /* { dg-error "excess elements in char array initializer" } */ +char t[1] = "xy"; /* { dg-warning "initializer-string for array of 'char' is too long" } */ +char t1[1] = { "xy" }; /* { dg-warning "initializer-string for array of 'char' is too long" } */ +char u[1] = { "x", "x" }; /* { dg-error "excess elements in 'char' array initializer" } */ /* { dg-message "near init" "near" { target *-*-* } .-1 } */ int j = { 1 }; diff --git a/gcc/testsuite/gcc.dg/init-bad-3.c b/gcc/testsuite/gcc.dg/init-bad-3.c index d320e0e399f..c5c338d9a85 100644 --- a/gcc/testsuite/gcc.dg/init-bad-3.c +++ b/gcc/testsuite/gcc.dg/init-bad-3.c @@ -17,9 +17,9 @@ void h(a) char s[1] = "x"; char s1[1] = { "x" }; -char t[1] = "xy"; /* { dg-error "initializer-string for array of chars is too long" } */ -char t1[1] = { "xy" }; /* { dg-error "initializer-string for array of chars is too long" } */ -char u[1] = { "x", "x" }; /* { dg-error "excess elements in char array initializer" } */ +char t[1] = "xy"; /* { dg-error "initializer-string for array of 'char' is too long" } */ +char t1[1] = { "xy" }; /* { dg-error "initializer-string for array of 'char' is too long" } */ +char u[1] = { "x", "x" }; /* { dg-error "excess elements in 'char' array initializer" } */ /* { dg-message "near init" "near" { target *-*-* } .-1 } */ int j = { 1 }; diff --git a/gcc/testsuite/gcc.dg/pr27528.c b/gcc/testsuite/gcc.dg/pr27528.c index c9bb238e96b..d63238eab07 100644 --- a/gcc/testsuite/gcc.dg/pr27528.c +++ b/gcc/testsuite/gcc.dg/pr27528.c @@ -7,16 +7,16 @@ void foo (int *x, int y) { int constant = 0; - asm ("# %0" :: "i" (x)); /* { dg-warning "probably doesn't match" } */ + asm ("# %0" :: "i" (x)); /* { dg-warning "probably does not match" } */ /* { dg-error "impossible constraint" "" { target *-*-* } .-1 } */ - asm ("# %0" :: "i" (bar (*x))); /* { dg-warning "probably doesn't match" } */ + asm ("# %0" :: "i" (bar (*x))); /* { dg-warning "probably does not match" } */ /* { dg-error "impossible constraint" "" { target *-*-* } .-1 } */ - asm ("# %0" :: "i" (*x + 0x11)); /* { dg-warning "probably doesn't match" } */ + asm ("# %0" :: "i" (*x + 0x11)); /* { dg-warning "probably does not match" } */ /* { dg-error "impossible constraint" "" { target *-*-* } .-1 } */ - asm ("# %0" :: "i" (constant)); /* { dg-warning "probably doesn't match" } */ + asm ("# %0" :: "i" (constant)); /* { dg-warning "probably does not match" } */ /* { dg-error "impossible constraint" "" { target *-*-* } .-1 } */ asm ("# %0" :: "i" (y * 0)); /* folded */ diff --git a/gcc/testsuite/gcc.dg/pr48552-1.c b/gcc/testsuite/gcc.dg/pr48552-1.c index 6626a58ea48..70d3483d80c 100644 --- a/gcc/testsuite/gcc.dg/pr48552-1.c +++ b/gcc/testsuite/gcc.dg/pr48552-1.c @@ -15,7 +15,7 @@ f2 (void *x) { __asm volatile ("" : "=r" (*x)); /* { dg-warning "dereferencing" "deref" } */ } /* { dg-error "invalid use of void expression" "void expr" { target *-*-* } .-1 } */ - /* { dg-error "invalid lvalue in asm output 0" "invalid lvalue" { target *-*-* } .-2 } */ + /* { dg-error "invalid lvalue in 'asm' output 0" "invalid lvalue" { target *-*-* } .-2 } */ void f3 (void *x) { @@ -39,7 +39,7 @@ f6 (void *x) { __asm volatile ("" : "=g" (*x)); /* { dg-warning "dereferencing" "deref" } */ } /* { dg-error "invalid use of void expression" "void expr" { target *-*-* } .-1 } */ - /* { dg-error "invalid lvalue in asm output 0" "invalid lvalue" { target *-*-* } .-2 } */ + /* { dg-error "invalid lvalue in 'asm' output 0" "invalid lvalue" { target *-*-* } .-2 } */ void f7 (struct S *x) { @@ -49,5 +49,5 @@ f7 (struct S *x) void f8 (struct S *x) { - __asm volatile ("" : "=r" (*x)); /* { dg-error "invalid lvalue in asm output 0" } */ + __asm volatile ("" : "=r" (*x)); /* { dg-error "invalid lvalue in 'asm' output 0" } */ } diff --git a/gcc/testsuite/gcc.dg/pr48552-2.c b/gcc/testsuite/gcc.dg/pr48552-2.c index c3aca89645c..ce6bece3f96 100644 --- a/gcc/testsuite/gcc.dg/pr48552-2.c +++ b/gcc/testsuite/gcc.dg/pr48552-2.c @@ -15,7 +15,7 @@ f2 (void *x) { __asm ("" : "=r" (*x)); /* { dg-warning "dereferencing" "deref" } */ } /* { dg-error "invalid use of void expression" "void expr" { target *-*-* } .-1 } */ - /* { dg-error "invalid lvalue in asm output 0" "invalid lvalue" { target *-*-* } .-2 } */ + /* { dg-error "invalid lvalue in 'asm' output 0" "invalid lvalue" { target *-*-* } .-2 } */ void f3 (void *x) { @@ -39,7 +39,7 @@ f6 (void *x) { __asm ("" : "=g" (*x)); /* { dg-warning "dereferencing" "deref" } */ } /* { dg-error "invalid use of void expression" "void expr" { target *-*-* } .-1 } */ - /* { dg-error "invalid lvalue in asm output 0" "invalid lvalue" { target *-*-* } .-2 } */ + /* { dg-error "invalid lvalue in 'asm' output 0" "invalid lvalue" { target *-*-* } .-2 } */ void f7 (struct S *x) { @@ -49,5 +49,5 @@ f7 (struct S *x) void f8 (struct S *x) { - __asm ("" : "=r" (*x)); /* { dg-error "invalid lvalue in asm output 0" } */ + __asm ("" : "=r" (*x)); /* { dg-error "invalid lvalue in 'asm' output 0" } */ } diff --git a/gcc/testsuite/gcc.dg/pr59846.c b/gcc/testsuite/gcc.dg/pr59846.c index b3dd0de9ea6..9b01b22631c 100644 --- a/gcc/testsuite/gcc.dg/pr59846.c +++ b/gcc/testsuite/gcc.dg/pr59846.c @@ -17,13 +17,13 @@ fn2 (unsigned int p) _Bool fn3 (unsigned int p) { - return p >= 0U; /* { dg-warning "12:comparison of unsigned expression >= 0 is always true" } */ + return p >= 0U; /* { dg-warning "12:comparison of unsigned expression in '>= 0' is always true" } */ } _Bool fn4 (unsigned int p) { - return p < 0U; /* { dg-warning "12:comparison of unsigned expression < 0 is always false" } */ + return p < 0U; /* { dg-warning "12:comparison of unsigned expression in '< 0' is always false" } */ } _Bool diff --git a/gcc/testsuite/gcc.dg/pr61096-1.c b/gcc/testsuite/gcc.dg/pr61096-1.c index 111585dd025..e707904c087 100644 --- a/gcc/testsuite/gcc.dg/pr61096-1.c +++ b/gcc/testsuite/gcc.dg/pr61096-1.c @@ -47,7 +47,7 @@ __extension__ int a15[10] = {[2 ... 1] = 4 }; /* { dg-error "31:empty index rang __extension__ int a16[10] = {[2 ... 100] = 4 }; /* { dg-error "31:array index range in initializer exceeds array bounds" } */ int a17[] = { .B = 1 }; /* { dg-error "15:field name not in record or union initializer" } */ int a18[] = { e }; /* { dg-error "15:initializer element is not constant" } */ -char a19[1] = { "x", "x" }; /* { dg-error "22:excess elements in char array initializer" } */ +char a19[1] = { "x", "x" }; /* { dg-error "22:excess elements in 'char' array initializer" } */ void bar (void) diff --git a/gcc/testsuite/gcc.dg/pr8788-1.c b/gcc/testsuite/gcc.dg/pr8788-1.c index b05f533dc0f..2281a02f17a 100644 --- a/gcc/testsuite/gcc.dg/pr8788-1.c +++ b/gcc/testsuite/gcc.dg/pr8788-1.c @@ -12,7 +12,7 @@ typedef struct { void switch_to_stack (my_stack *stack){ asm ( /* { dg-error "impossible constraint" } */ -/* { dg-warning "asm operand 1" "asm operand 1" { target *-*-* } .-1 } */ +/* { dg-warning "'asm' operand 1" "asm operand 1" { target *-*-* } .-1 } */ "\n" : "+r" (stack->regs) ); diff --git a/gcc/testsuite/gcc.dg/pr90082.c b/gcc/testsuite/gcc.dg/pr90082.c index bb8293fb633..663a171821b 100644 --- a/gcc/testsuite/gcc.dg/pr90082.c +++ b/gcc/testsuite/gcc.dg/pr90082.c @@ -9,5 +9,5 @@ foo (int a) { if (__builtin_setjmp (buf) == 0) __asm__ ("" : : "n" (a * 2)); /* { dg-error "impossible constraint in 'asm'" } */ - /* { dg-warning "asm operand 0 probably doesn't match constraints" "" { target *-*-* } .-1 } */ + /* { dg-warning "'asm' operand 0 probably does not match constraints" "" { target *-*-* } .-1 } */ } diff --git a/gcc/testsuite/gcc.dg/simd-2.c b/gcc/testsuite/gcc.dg/simd-2.c index 13e1caba6cb..e5462390eff 100644 --- a/gcc/testsuite/gcc.dg/simd-2.c +++ b/gcc/testsuite/gcc.dg/simd-2.c @@ -33,10 +33,10 @@ hanneke () foo = a; /* { dg-error "incompatible types when assigning" } */ /* Casted assignment between scalar and SIMD of same size. */ - foo = (typeof (foo)) foo2; /* { dg-error "aggregate value used where a float was expected" } */ + foo = (typeof (foo)) foo2; /* { dg-error "aggregate value used where a floating point was expected" } */ /* Casted assignment between scalar and SIMD of different size. */ - foo1 = (typeof (foo1)) foo2; /* { dg-error "aggregate value used where a float was expected" } */ + foo1 = (typeof (foo1)) foo2; /* { dg-error "aggregate value used where a floating point was expected" } */ /* Operators on compatible SIMD types. */ a += b + b; diff --git a/gcc/testsuite/gcc.dg/spellcheck-params-2.c b/gcc/testsuite/gcc.dg/spellcheck-params-2.c index 27e293ffa60..8187de43481 100644 --- a/gcc/testsuite/gcc.dg/spellcheck-params-2.c +++ b/gcc/testsuite/gcc.dg/spellcheck-params-2.c @@ -1,4 +1,4 @@ /* { dg-do compile } */ /* { dg-options "--param does-not-resemble-anything=42" } */ -/* { dg-error "invalid --param name .does-not-resemble-anything." "" { target *-*-* } 0 } */ +/* { dg-error "invalid '--param' name 'does-not-resemble-anything'" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.dg/spellcheck-params.c b/gcc/testsuite/gcc.dg/spellcheck-params.c index 1bb7bca6024..01e1343ab9e 100644 --- a/gcc/testsuite/gcc.dg/spellcheck-params.c +++ b/gcc/testsuite/gcc.dg/spellcheck-params.c @@ -1,4 +1,4 @@ /* { dg-do compile } */ /* { dg-options "--param max-early-inliner-iteration=3" } */ -/* { dg-error "invalid --param name .max-early-inliner-iteration.; did you mean .max-early-inliner-iterations.?" "" { target *-*-* } 0 } */ +/* { dg-error "invalid '--param' name 'max-early-inliner-iteration'; did you mean 'max-early-inliner-iterations'?" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.dg/strlenopt-49.c b/gcc/testsuite/gcc.dg/strlenopt-49.c index 2e6ccd32f19..f901fd14b54 100644 --- a/gcc/testsuite/gcc.dg/strlenopt-49.c +++ b/gcc/testsuite/gcc.dg/strlenopt-49.c @@ -11,8 +11,8 @@ const char a3[3] = "12\0"; const char a8[8] = "1234567\0"; const char a9[9] = "12345678\0"; -const char ax[9] = "12345678\0\0\0\0"; /* { dg-warning "initializer-string for array of chars is too long" } */ -const char ay[9] = "\00012345678\0\0\0\0"; /* { dg-warning "initializer-string for array of chars is too long" } */ +const char ax[9] = "12345678\0\0\0\0"; /* { dg-warning "initializer-string for array of 'char' is too long" } */ +const char ay[9] = "\00012345678\0\0\0\0"; /* { dg-warning "initializer-string for array of 'char' is too long" } */ int len1 (void) diff --git a/gcc/testsuite/gcc.dg/tm/pr52141.c b/gcc/testsuite/gcc.dg/tm/pr52141.c index 0dabf76ce6d..dbaab307a1e 100644 --- a/gcc/testsuite/gcc.dg/tm/pr52141.c +++ b/gcc/testsuite/gcc.dg/tm/pr52141.c @@ -4,7 +4,7 @@ __attribute__((always_inline)) static void asmfunc(void) { - __asm__ (""); /* { dg-error "asm not allowed in .transaction_safe" } */ + __asm__ (""); /* { dg-error "'asm' not allowed in 'transaction_safe" } */ } __attribute__((transaction_safe)) diff --git a/gcc/testsuite/gcc.dg/torture/pr51106-1.c b/gcc/testsuite/gcc.dg/torture/pr51106-1.c index 8a1227d30d6..5501b546fe0 100644 --- a/gcc/testsuite/gcc.dg/torture/pr51106-1.c +++ b/gcc/testsuite/gcc.dg/torture/pr51106-1.c @@ -6,7 +6,7 @@ int foo (int x) { asm goto ("" : : "i" (x) : : lab); /* { dg-error "impossible constraint" } */ - /* { dg-warning "probably doesn.t match constraints" "" { target *-*-* } .-1 } */ + /* { dg-warning "probably does not match constraints" "" { target *-*-* } .-1 } */ return 1; lab: return 0; diff --git a/gcc/testsuite/gcc.dg/torture/pr51106-2.c b/gcc/testsuite/gcc.dg/torture/pr51106-2.c index aa76a71c58d..2dbb832b7cc 100644 --- a/gcc/testsuite/gcc.dg/torture/pr51106-2.c +++ b/gcc/testsuite/gcc.dg/torture/pr51106-2.c @@ -7,7 +7,7 @@ int bar (int x) { asm goto ("" : : "i" (x) : : lab); /* { dg-error "impossible constraint" } */ -/* { dg-warning "probably doesn.t match constraints" "" { target *-*-* } .-1 } */ +/* { dg-warning "probably does not match constraints" "" { target *-*-* } .-1 } */ __builtin_unreachable (); lab: return 0; diff --git a/gcc/testsuite/gcc.dg/utf-array-short-wchar.c b/gcc/testsuite/gcc.dg/utf-array-short-wchar.c index a582e71178c..81b452a33a1 100644 --- a/gcc/testsuite/gcc.dg/utf-array-short-wchar.c +++ b/gcc/testsuite/gcc.dg/utf-array-short-wchar.c @@ -21,8 +21,8 @@ const char16_t s16_2[] = U"ab"; /* { dg-error "from a string literal with type a const char16_t s16_3[] = L"ab"; const char16_t s16_4[] = u8"ab"; /* { dg-error "from a string literal with type array of .char." } */ -const char16_t s16_5[0] = u"ab"; /* { dg-warning "chars is too long" } */ -const char16_t s16_6[1] = u"ab"; /* { dg-warning "chars is too long" } */ +const char16_t s16_5[0] = u"ab"; /* { dg-warning " is too long" } */ +const char16_t s16_6[1] = u"ab"; /* { dg-warning " is too long" } */ const char16_t s16_7[2] = u"ab"; const char16_t s16_8[3] = u"ab"; const char16_t s16_9[4] = u"ab"; @@ -33,11 +33,11 @@ const char32_t s32_2[] = U"ab"; const char32_t s32_3[] = L"ab"; /* { dg-error "from a string literal with type array of" } */ const char32_t s32_4[] = u8"ab"; /* { dg-error "from a string literal with type array of .char." } */ -const char32_t s32_5[0] = U"ab"; /* { dg-warning "chars is too long" } */ -const char32_t s32_6[1] = U"ab"; /* { dg-warning "chars is too long" } */ -const char32_t s32_7[2] = U"ab"; /* { dg-warning "chars is too long" "" { target "m32c-*-*" } } */ -const char32_t s32_8[3] = U"ab"; /* { dg-warning "chars is too long" "" { target "m32c-*-*" } } */ -const char32_t s32_9[4] = U"ab"; /* { dg-warning "chars is too long" "" { target "m32c-*-*" } } */ +const char32_t s32_5[0] = U"ab"; /* { dg-warning " is too long" } */ +const char32_t s32_6[1] = U"ab"; /* { dg-warning " is too long" } */ +const char32_t s32_7[2] = U"ab"; /* { dg-warning " is too long" "" { target "m32c-*-*" } } */ +const char32_t s32_8[3] = U"ab"; /* { dg-warning " is too long" "" { target "m32c-*-*" } } */ +const char32_t s32_9[4] = U"ab"; /* { dg-warning " is too long" "" { target "m32c-*-*" } } */ const wchar_t sw_0[] = "ab"; /* { dg-error "from a string literal with type array of .char." } */ const wchar_t sw_1[] = u"ab"; diff --git a/gcc/testsuite/gcc.dg/utf-array.c b/gcc/testsuite/gcc.dg/utf-array.c index 8687989a061..7f0cb915e04 100644 --- a/gcc/testsuite/gcc.dg/utf-array.c +++ b/gcc/testsuite/gcc.dg/utf-array.c @@ -21,8 +21,8 @@ const char16_t s16_2[] = U"ab"; /* { dg-error "from a string literal with type a const char16_t s16_3[] = L"ab"; /* { dg-error "from a string literal with type array of .(long |short )?(unsigned )?int." "" { target { ! wchar_t_char16_t_compatible } } } */ const char16_t s16_4[] = u8"ab"; /* { dg-error "from a string literal with type array of .char." } */ -const char16_t s16_5[0] = u"ab"; /* { dg-warning "chars is too long" } */ -const char16_t s16_6[1] = u"ab"; /* { dg-warning "chars is too long" } */ +const char16_t s16_5[0] = u"ab"; /* { dg-warning " is too long" } */ +const char16_t s16_6[1] = u"ab"; /* { dg-warning " is too long" } */ const char16_t s16_7[2] = u"ab"; const char16_t s16_8[3] = u"ab"; const char16_t s16_9[4] = u"ab"; @@ -33,11 +33,11 @@ const char32_t s32_2[] = U"ab"; const char32_t s32_3[] = L"ab"; /* { dg-error "from a string literal with type array of .(long |short )?(unsigned )?int." "" { target { ! wchar_t_char32_t_compatible } } } */ const char32_t s32_4[] = u8"ab"; /* { dg-error "from a string literal with type array of .char." } */ -const char32_t s32_5[0] = U"ab"; /* { dg-warning "chars is too long" } */ -const char32_t s32_6[1] = U"ab"; /* { dg-warning "chars is too long" } */ -const char32_t s32_7[2] = U"ab"; /* { dg-warning "chars is too long" "" { target "m32c-*-*" } } */ -const char32_t s32_8[3] = U"ab"; /* { dg-warning "chars is too long" "" { target "m32c-*-*" } } */ -const char32_t s32_9[4] = U"ab"; /* { dg-warning "chars is too long" "" { target "m32c-*-*" } } */ +const char32_t s32_5[0] = U"ab"; /* { dg-warning " is too long" } */ +const char32_t s32_6[1] = U"ab"; /* { dg-warning " is too long" } */ +const char32_t s32_7[2] = U"ab"; /* { dg-warning " is too long" "" { target "m32c-*-*" } } */ +const char32_t s32_8[3] = U"ab"; /* { dg-warning " is too long" "" { target "m32c-*-*" } } */ +const char32_t s32_9[4] = U"ab"; /* { dg-warning " is too long" "" { target "m32c-*-*" } } */ const wchar_t sw_0[] = "ab"; /* { dg-error "from a string literal with type array of .char." } */ const wchar_t sw_1[] = u"ab"; /* { dg-error "from a string literal with type array of" "" { target { ! wchar_t_char16_t_compatible } } } */ diff --git a/gcc/testsuite/gcc.dg/utf8-2.c b/gcc/testsuite/gcc.dg/utf8-2.c index d96b15dccb7..b3b873dfd8a 100644 --- a/gcc/testsuite/gcc.dg/utf8-2.c +++ b/gcc/testsuite/gcc.dg/utf8-2.c @@ -12,16 +12,16 @@ const char16_t s1[] = u8"ab"; /* { dg-error "from a string literal with type arr const char32_t s2[] = u8"ab"; /* { dg-error "from a string literal with type array of .char." } */ const wchar_t s3[] = u8"ab"; /* { dg-error "from a string literal with type array of .char." } */ -const char t0[0] = u8"ab"; /* { dg-warning "chars is too long" } */ -const char t1[1] = u8"ab"; /* { dg-warning "chars is too long" } */ +const char t0[0] = u8"ab"; /* { dg-warning " is too long" } */ +const char t1[1] = u8"ab"; /* { dg-warning " is too long" } */ const char t2[2] = u8"ab"; const char t3[3] = u8"ab"; const char t4[4] = u8"ab"; -const char u0[0] = u8"\u2160."; /* { dg-warning "chars is too long" } */ -const char u1[1] = u8"\u2160."; /* { dg-warning "chars is too long" } */ -const char u2[2] = u8"\u2160."; /* { dg-warning "chars is too long" } */ -const char u3[3] = u8"\u2160."; /* { dg-warning "chars is too long" } */ +const char u0[0] = u8"\u2160."; /* { dg-warning " is too long" } */ +const char u1[1] = u8"\u2160."; /* { dg-warning " is too long" } */ +const char u2[2] = u8"\u2160."; /* { dg-warning " is too long" } */ +const char u3[3] = u8"\u2160."; /* { dg-warning " is too long" } */ const char u4[4] = u8"\u2160."; const char u5[5] = u8"\u2160."; const char u6[6] = u8"\u2160."; diff --git a/gcc/testsuite/gcc.dg/warn-sprintf-no-nul.c b/gcc/testsuite/gcc.dg/warn-sprintf-no-nul.c index b331bb5aaff..a38679fa888 100644 --- a/gcc/testsuite/gcc.dg/warn-sprintf-no-nul.c +++ b/gcc/testsuite/gcc.dg/warn-sprintf-no-nul.c @@ -26,7 +26,7 @@ void sink (int, ...); const char a[5] = "12345"; /* { dg-message "declared here" } */ const char b[6] = "123456"; /* { dg-message "declared here" } */ const char a2[][3] = { - "", "1", "12", "123", "123\000" /* { dg-warning "initializer-string for array of chars is too long" } */ + "", "1", "12", "123", "123\000" /* { dg-warning "initializer-string for array of 'char' is too long" } */ }; diff --git a/gcc/testsuite/gcc.target/i386/asm-flag-0.c b/gcc/testsuite/gcc.target/i386/asm-flag-0.c index b0c05239b01..e7bd1a585f9 100644 --- a/gcc/testsuite/gcc.target/i386/asm-flag-0.c +++ b/gcc/testsuite/gcc.target/i386/asm-flag-0.c @@ -11,5 +11,5 @@ void a(void) void b(void) { char x; - asm("" : "=@ccbad"(x)); /* { dg-error "unknown asm flag output" } */ + asm("" : "=@ccbad"(x)); /* { dg-error "unknown 'asm' flag output" } */ } diff --git a/gcc/testsuite/gcc.target/i386/inline_error.c b/gcc/testsuite/gcc.target/i386/inline_error.c index 18e506631eb..57e60fbadef 100644 --- a/gcc/testsuite/gcc.target/i386/inline_error.c +++ b/gcc/testsuite/gcc.target/i386/inline_error.c @@ -2,7 +2,7 @@ /* { dg-options "-O0 -mno-popcnt" } */ inline int __attribute__ ((__gnu_inline__, __always_inline__, target("popcnt"))) -foo () /* { dg-error "inlining failed in call to always_inline .* target specific option mismatch" } */ +foo () /* { dg-error "inlining failed in call to 'always_inline' .* target specific option mismatch" } */ { return 0; } diff --git a/gcc/testsuite/gcc.target/i386/pr30848.c b/gcc/testsuite/gcc.target/i386/pr30848.c index 2a92851516c..9c4e22ac716 100644 --- a/gcc/testsuite/gcc.target/i386/pr30848.c +++ b/gcc/testsuite/gcc.target/i386/pr30848.c @@ -2,5 +2,5 @@ void foo(double d) { - __asm__ ("" : "=u" (d)); /* { dg-error "output regs" } */ + __asm__ ("" : "=u" (d)); /* { dg-error "output registers" } */ } diff --git a/gcc/testsuite/gcc.target/i386/pr39082-1.c b/gcc/testsuite/gcc.target/i386/pr39082-1.c index 2af2264c3cc..85b5671e920 100644 --- a/gcc/testsuite/gcc.target/i386/pr39082-1.c +++ b/gcc/testsuite/gcc.target/i386/pr39082-1.c @@ -13,7 +13,7 @@ extern int bar1 (union un); extern union un bar2 (int); int -foo1 (union un u) /* { dg-message "note: the ABI of passing union with long double has changed in GCC 4.4" } */ +foo1 (union un u) /* { dg-message "note: the ABI of passing union with 'long double' has changed in GCC 4.4" } */ { bar1 (u); return u.i; diff --git a/gcc/testsuite/gcc.target/i386/pr39678.c b/gcc/testsuite/gcc.target/i386/pr39678.c index 0548466d6de..c94c002f14b 100644 --- a/gcc/testsuite/gcc.target/i386/pr39678.c +++ b/gcc/testsuite/gcc.target/i386/pr39678.c @@ -10,7 +10,7 @@ struct X { struct X foo (float *p) -{ /* { dg-message "note: the ABI of passing structure with complex float member has changed in GCC 4.4" } */ +{ /* { dg-message "note: the ABI of passing structure with 'complex float' member has changed in GCC 4.4" } */ struct X x; x.c = -3; __real x.val = p[0]; diff --git a/gcc/testsuite/gcc.target/i386/pr57756.c b/gcc/testsuite/gcc.target/i386/pr57756.c index 25c565c879a..9a78f62c98c 100644 --- a/gcc/testsuite/gcc.target/i386/pr57756.c +++ b/gcc/testsuite/gcc.target/i386/pr57756.c @@ -3,7 +3,7 @@ /* callee cannot be inlined into caller because it has a higher target ISA. */ __attribute__((always_inline,target("sse4.2"))) -__inline int callee () /* { dg-error "inlining failed in call to always_inline" } */ +__inline int callee () /* { dg-error "inlining failed in call to 'always_inline'" } */ { return 0; } diff --git a/gcc/testsuite/gcc.target/i386/pr68843-1.c b/gcc/testsuite/gcc.target/i386/pr68843-1.c index da0676aa69b..6198ea9af05 100644 --- a/gcc/testsuite/gcc.target/i386/pr68843-1.c +++ b/gcc/testsuite/gcc.target/i386/pr68843-1.c @@ -5,7 +5,7 @@ double test () { double x = 1.0; - asm ("fld %1" /* { dg-error "explicitly used regs must be grouped at top of stack" } */ + asm ("fld %1" /* { dg-error "explicitly used registers must be grouped at top of stack" } */ : "=&t" (x) : "u" (x)); return x; diff --git a/gcc/testsuite/gcc.target/i386/pr79804.c b/gcc/testsuite/gcc.target/i386/pr79804.c index 10adb44667a..08d1a3ea1f1 100644 --- a/gcc/testsuite/gcc.target/i386/pr79804.c +++ b/gcc/testsuite/gcc.target/i386/pr79804.c @@ -7,4 +7,4 @@ void foo (void) register int r19 asm ("19"); asm volatile ("# %0" : "=r"(r19)); /* { dg-error "invalid use of register" } */ -} /* { dg-error "cannot be used in asm here" } */ +} /* { dg-error "cannot be used in 'asm' here" } */ diff --git a/gcc/testsuite/gcc.target/i386/pr82673.c b/gcc/testsuite/gcc.target/i386/pr82673.c index 50eb5a3bcfc..161ec88e3a7 100644 --- a/gcc/testsuite/gcc.target/i386/pr82673.c +++ b/gcc/testsuite/gcc.target/i386/pr82673.c @@ -9,4 +9,4 @@ void bar (void) /* { dg-error "frame pointer required, but reserved" } */ { B = &y; -} /* { dg-error "bp cannot be used in asm here" } */ +} /* { dg-error "bp cannot be used in 'asm' here" } */ diff --git a/gcc/testsuite/obj-c++.dg/class-protocol-1.mm b/gcc/testsuite/obj-c++.dg/class-protocol-1.mm index f0eab03eff9..78957cb061e 100644 --- a/gcc/testsuite/obj-c++.dg/class-protocol-1.mm +++ b/gcc/testsuite/obj-c++.dg/class-protocol-1.mm @@ -436,6 +436,4 @@ int main () return(0); } -/* { dg-warning "Messages without a matching method signature" "" { target *-*-* } 0 } */ -/* { dg-warning "will be assumed to return .id. and accept" "" { target *-*-* } 0 } */ -/* { dg-warning ".\.\.\.. as arguments" "" { target *-*-* } 0 } */ +/* { dg-warning "messages without a matching method signature will be assumed to return .id. and accept .\.\.\.. as arguments" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/obj-c++.dg/exceptions-3.mm b/gcc/testsuite/obj-c++.dg/exceptions-3.mm index 90a657c8d70..622e4ca3b60 100644 --- a/gcc/testsuite/obj-c++.dg/exceptions-3.mm +++ b/gcc/testsuite/obj-c++.dg/exceptions-3.mm @@ -27,19 +27,19 @@ int test (id object) int dummy = 0; @try { @throw object; } - @catch (int x) /* { dg-error "@catch parameter is not a known Objective-C class type" } */ + @catch (int x) /* { dg-error "'@catch' parameter is not a known Objective-C class type" } */ { dummy++; } @try { @throw object; } - @catch (intTypedef x) /* { dg-error "@catch parameter is not a known Objective-C class type" } */ + @catch (intTypedef x) /* { dg-error "'@catch' parameter is not a known Objective-C class type" } */ { dummy++; } @try { @throw object; } - @catch (int *x) /* { dg-error "@catch parameter is not a known Objective-C class type" } */ + @catch (int *x) /* { dg-error "'@catch' parameter is not a known Objective-C class type" } */ { dummy++; } @@ -51,7 +51,7 @@ int test (id object) } @try { @throw object; } - @catch (id x) /* { dg-error "@catch parameter cannot be protocol-qualified" } */ + @catch (id x) /* { dg-error "'@catch' parameter cannot be protocol-qualified" } */ { dummy++; } @@ -63,13 +63,13 @@ int test (id object) } @try { @throw object; } - @catch (MyObject *x) /* { dg-error "@catch parameter cannot be protocol-qualified" } */ + @catch (MyObject *x) /* { dg-error "'@catch' parameter cannot be protocol-qualified" } */ { dummy++; } @try { @throw object; } - @catch (MyObject x) /* { dg-error "@catch parameter is not a known Objective-C class type" } */ + @catch (MyObject x) /* { dg-error "'@catch' parameter is not a known Objective-C class type" } */ { /* { dg-error "no matching function" "" { target *-*-* } .-1 } */ dummy++; /* { dg-message "MyObject" "" { target *-*-* } interface_MyObject } */ } /* { dg-message "candidate" "" { target *-*-* } interface_MyObject } */ @@ -86,7 +86,7 @@ int test (id object) } @try { @throw object; } - @catch (MyObjectTypedef *x) /* { dg-error "@catch parameter cannot be protocol-qualified" } */ + @catch (MyObjectTypedef *x) /* { dg-error "'@catch' parameter cannot be protocol-qualified" } */ { dummy++; } @@ -98,7 +98,7 @@ int test (id object) } @try { @throw object; } - @catch (Class x) /* { dg-error "@catch parameter is not a known Objective-C class type" } */ + @catch (Class x) /* { dg-error "'@catch' parameter is not a known Objective-C class type" } */ { dummy++; } diff --git a/gcc/testsuite/obj-c++.dg/exceptions-4.mm b/gcc/testsuite/obj-c++.dg/exceptions-4.mm index ccdeb34a015..4aa00a6006f 100644 --- a/gcc/testsuite/obj-c++.dg/exceptions-4.mm +++ b/gcc/testsuite/obj-c++.dg/exceptions-4.mm @@ -33,18 +33,18 @@ int test (id object) @try { @throw object; } @catch { /* { dg-error "expected" } */ - dummy++; /* { dg-error "@catch parameter is not a known Objective-C class type" "" { target *-*-* } .-1 } */ + dummy++; /* { dg-error "'@catch' parameter is not a known Objective-C class type" "" { target *-*-* } .-1 } */ } @catch () /* { dg-error "expected identifier before" } */ - { /* { dg-error "@catch parameter is not a known Objective-C class type" "" { target *-*-* } .-1 } */ + { /* { dg-error "'@catch' parameter is not a known Objective-C class type" "" { target *-*-* } .-1 } */ dummy++; } @catch (i) /* { dg-error ".i. has not been declared" } */ - { /* { dg-error "@catch parameter is not a known Objective-C class type" "" { target *-*-* } .-1 } */ + { /* { dg-error "'@catch' parameter is not a known Objective-C class type" "" { target *-*-* } .-1 } */ dummy++; } @catch (id ) /* { dg-error "@catch parameter cannot be protocol-qualified" } */ + @catch (id ) /* { dg-error "'@catch' parameter cannot be protocol-qualified" } */ { dummy++; } @@ -63,13 +63,13 @@ int test (id object) } @try { @throw object; } - @catch (MyObject *) /* { dg-error "@catch parameter cannot be protocol-qualified" } */ + @catch (MyObject *) /* { dg-error "'@catch' parameter cannot be protocol-qualified" } */ { dummy++; } @try { @throw object; } - @catch (MyObject) /* { dg-error "@catch parameter is not a known Objective-C class type" } */ + @catch (MyObject) /* { dg-error "'@catch' parameter is not a known Objective-C class type" } */ { /* { dg-error "no matching function" "" { target *-*-* } .-1 } */ dummy++; /* { dg-message "MyObject" "" { target *-*-* } interface_MyObject } */ } /* { dg-message "candidate" "" { target *-*-* } interface_MyObject } */ @@ -87,7 +87,7 @@ int test (id object) } @try { @throw object; } - @catch (MyObjectTypedef *) /* { dg-error "@catch parameter cannot be protocol-qualified" } */ + @catch (MyObjectTypedef *) /* { dg-error "'@catch' parameter cannot be protocol-qualified" } */ { dummy++; } @@ -99,7 +99,7 @@ int test (id object) } @try { @throw object; } - @catch (Class) /* { dg-error "@catch parameter is not a known Objective-C class type" } */ + @catch (Class) /* { dg-error "'@catch' parameter is not a known Objective-C class type" } */ { dummy++; } diff --git a/gcc/testsuite/obj-c++.dg/exceptions-6.mm b/gcc/testsuite/obj-c++.dg/exceptions-6.mm index 6f6ba783ea7..7a776a518a2 100644 --- a/gcc/testsuite/obj-c++.dg/exceptions-6.mm +++ b/gcc/testsuite/obj-c++.dg/exceptions-6.mm @@ -9,7 +9,7 @@ void test (id object) { @throw object; /* Ok */ - @throw; /* { dg-error ".@throw. .rethrow. used outside of a @catch block" } */ + @throw; /* { dg-error ".@throw. .rethrow. used outside of a '@catch' block" } */ @throw (object); /* Ok. */ @throw (id)0 /* { dg-error "expected" } */ } diff --git a/gcc/testsuite/obj-c++.dg/method-12.mm b/gcc/testsuite/obj-c++.dg/method-12.mm index 2282dec5b15..45461445178 100644 --- a/gcc/testsuite/obj-c++.dg/method-12.mm +++ b/gcc/testsuite/obj-c++.dg/method-12.mm @@ -24,9 +24,7 @@ void foo(void) { /* { dg-message "also found .\\+\\(Protocol \\*\\)port." "" { target *-*-* } Derived_port_last } */ [receiver starboard]; /* { dg-warning "no .\\+starboard. method found" } */ - /* { dg-warning "Messages without a matching method signature" "" { target *-*-* } .-1 } */ - /* { dg-warning "will be assumed to return .id. and accept" "" { target *-*-* } .-2 } */ - /* { dg-warning ".\.\.\.. as arguments" "" { target *-*-* } .-3 } */ + /* { dg-warning "messages without a matching method signature will be assumed to return .id. and accept .\.\.\.. as arguments" "" { target *-*-* } 0 } */ [Class port]; /* { dg-error ".Class. is not an Objective\\-C class name or alias" } */ } diff --git a/gcc/testsuite/obj-c++.dg/method-13.mm b/gcc/testsuite/obj-c++.dg/method-13.mm index b0a1f591117..cd53d0f2f16 100644 --- a/gcc/testsuite/obj-c++.dg/method-13.mm +++ b/gcc/testsuite/obj-c++.dg/method-13.mm @@ -16,10 +16,9 @@ id foo(void) { TestsuiteObject *obj = [[TestsuiteObject alloc] init]; id obj2 = obj; [obj setWindow:nil]; /* { dg-warning ".TestsuiteObject. may not respond to .\\-setWindow:." } */ - /* { dg-warning "Messages without a matching method signature" "" { target *-*-* } .-1 } */ - /* { dg-warning "will be assumed to return .id. and accept" "" { target *-*-* } .-2 } */ - /* { dg-warning ".\.\.\.. as arguments" "" { target *-*-* } .-3 } */ - [obj2 setWindow:nil]; /* { dg-warning "multiple methods named .\\-setWindow:. found" } */ + /* { dg-warning "messages without a matching method signature will be assumed to return .id. and accept .\.\.\.. as arguments" "" { target *-*-* } 0 } */ + +[obj2 setWindow:nil]; /* { dg-warning "multiple methods named .\\-setWindow:. found" } */ /* { dg-message "using .\\-\\(void\\)setWindow:\\(TestsuiteObject \\*\\)wdw." "" { target *-*-* } Class1_setWindow } */ /* { dg-message "also found .\\-\\(void\\)setWindow:\\(Class1 \\*\\)window." "" { target *-*-* } Class2_setWindow } */ diff --git a/gcc/testsuite/obj-c++.dg/method-6.mm b/gcc/testsuite/obj-c++.dg/method-6.mm index 8f60511f788..65c0043e2e2 100644 --- a/gcc/testsuite/obj-c++.dg/method-6.mm +++ b/gcc/testsuite/obj-c++.dg/method-6.mm @@ -8,11 +8,9 @@ @class NotKnown; void foo(NotKnown *n) { - [NotKnown new]; /* { dg-warning ".interface of class .NotKnown. not found" } */ - [n nonexistent_method]; /* { dg-warning ".interface of class .NotKnown. not found" } */ + [NotKnown new]; /* { dg-warning "'.interface' of class .NotKnown. not found" } */ + [n nonexistent_method]; /* { dg-warning "'.interface' of class .NotKnown. not found" } */ /* { dg-warning "no .\\-nonexistent_method. method found" "" { target *-*-* } .-1 } */ } -/* { dg-warning "Messages without a matching method signature" "" { target *-*-* } 0 } */ -/* { dg-warning "will be assumed to return .id. and accept" "" { target *-*-* } 0 } */ -/* { dg-warning ".\.\.\.. as arguments" "" { target *-*-* } 0 } */ +/* { dg-warning "messages without a matching method signature will be assumed to return .id. and accept .\.\.\.. as arguments" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/obj-c++.dg/method-7.mm b/gcc/testsuite/obj-c++.dg/method-7.mm index 89409143e14..277a7e9e223 100644 --- a/gcc/testsuite/obj-c++.dg/method-7.mm +++ b/gcc/testsuite/obj-c++.dg/method-7.mm @@ -11,12 +11,10 @@ void foo(UnderSpecified *u, NotAClass *n) { [n nonexistent_method]; /* { dg-warning "invalid receiver type" } */ /* { dg-warning "no .\\-nonexistent_method. method found" "" { target *-*-* } .-1 } */ [NotAClass nonexistent_method]; /* { dg-error ".NotAClass. is not an Objective\\-C class name or alias" } */ - [u nonexistent_method]; /* { dg-warning ".interface of class .UnderSpecified. not found" } */ + [u nonexistent_method]; /* { dg-warning "'.interface' of class .UnderSpecified. not found" } */ /* { dg-warning "no .\\-nonexistent_method. method found" "" { target *-*-* } .-1 } */ - [UnderSpecified nonexistent_method]; /* { dg-warning ".interface of class .UnderSpecified. not found" } */ + [UnderSpecified nonexistent_method]; /* { dg-warning "'.interface' of class .UnderSpecified. not found" } */ /* { dg-warning "no .\\+nonexistent_method. method found" "" { target *-*-* } .-1 } */ } -/* { dg-warning "Messages without a matching method signature" "" { target *-*-* } 0 } */ -/* { dg-warning "will be assumed to return .id. and accept" "" { target *-*-* } 0 } */ -/* { dg-warning ".\.\.\.. as arguments" "" { target *-*-* } 0 } */ +/* { dg-warning "messages without a matching method signature will be assumed to return .id. and accept .\.\.\.. as arguments" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/obj-c++.dg/method-9.mm b/gcc/testsuite/obj-c++.dg/method-9.mm index 4509c4aa477..787e25d67ff 100644 --- a/gcc/testsuite/obj-c++.dg/method-9.mm +++ b/gcc/testsuite/obj-c++.dg/method-9.mm @@ -27,7 +27,4 @@ } @end -/* { dg-warning "Messages without a matching method signature" "" { target *-*-* } 0 } */ -/* { dg-warning "will be assumed to return .id. and accept" "" { target *-*-* } 0 } */ -/* { dg-warning ".\.\.\.. as arguments" "" { target *-*-* } 0 } */ - +/* { dg-warning "messages without a matching method signature will be assumed to return .id. and accept .\.\.\.. as arguments" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/obj-c++.dg/method-lookup-1.mm b/gcc/testsuite/obj-c++.dg/method-lookup-1.mm index 47499c37c08..e458471ff2c 100644 --- a/gcc/testsuite/obj-c++.dg/method-lookup-1.mm +++ b/gcc/testsuite/obj-c++.dg/method-lookup-1.mm @@ -39,7 +39,7 @@ void test (Class x, Class y, id w, id z, NotKnown *a, /* If a class is specified by name, the @interface must be available to check what it responds to. */ - [NotKnown classMethod]; /* { dg-warning ".interface of class .NotKnown. not found" } */ + [NotKnown classMethod]; /* { dg-warning "'.interface' of class .NotKnown. not found" } */ /* "id w" means that "w" responds to anything, both class and @@ -70,7 +70,7 @@ void test (Class x, Class y, id w, id z, NotKnown *a, because they expect the compiler to do type-checking; the @interface must be available to do this check, otherwise the compiler does not know what "a" responds to. */ - [a instanceMethod]; /* { dg-warning ".interface of class .NotKnown. not found" } */ + [a instanceMethod]; /* { dg-warning "'.interface' of class .NotKnown. not found" } */ /* But, if you cast it to "id", then you're disabling type-checking and the warnings should go away. */ diff --git a/gcc/testsuite/obj-c++.dg/proto-lossage-4.mm b/gcc/testsuite/obj-c++.dg/proto-lossage-4.mm index 2b9945fc16c..2e753d1f8ba 100644 --- a/gcc/testsuite/obj-c++.dg/proto-lossage-4.mm +++ b/gcc/testsuite/obj-c++.dg/proto-lossage-4.mm @@ -47,6 +47,4 @@ long foo(void) { return receiver; } -/* { dg-warning "Messages without a matching method signature" "" { target *-*-* } 0 } */ -/* { dg-warning "will be assumed to return .id. and accept" "" { target *-*-* } 0 } */ -/* { dg-warning ".\.\.\.. as arguments" "" { target *-*-* } 0 } */ +/* { dg-warning "messages without a matching method signature will be assumed to return .id. and accept .\.\.\.. as arguments" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/obj-c++.dg/protocol-qualifier-2.mm b/gcc/testsuite/obj-c++.dg/protocol-qualifier-2.mm index 9fb09b5f2bb..b59a6192aca 100644 --- a/gcc/testsuite/obj-c++.dg/protocol-qualifier-2.mm +++ b/gcc/testsuite/obj-c++.dg/protocol-qualifier-2.mm @@ -25,7 +25,6 @@ void test1 (void) { [object1 method]; /* Ok */ [object2 method]; /* { dg-warning ".MyClass. may not respond to ..method." } */ - /* { dg-warning "without a matching method" "" { target *-*-* } .-1 } */ - /* { dg-warning "will be assumed to return" "" { target *-*-* } .-2 } */ - /* { dg-warning "as arguments" "" { target *-*-* } .-3 } */ + + /* { dg-warning "Messages without a matching method signature will be assumed to return .id. and accept .\.\.\.. as arguments" "" { target *-*-* } 0 } */ } diff --git a/gcc/testsuite/objc.dg/call-super-2.m b/gcc/testsuite/objc.dg/call-super-2.m index af01d445364..0a3765f07fb 100644 --- a/gcc/testsuite/objc.dg/call-super-2.m +++ b/gcc/testsuite/objc.dg/call-super-2.m @@ -141,6 +141,4 @@ } @end -/* { dg-warning "Messages without a matching method signature" "" { target *-*-* } 0 } */ -/* { dg-warning "will be assumed to return .id. and accept" "" { target *-*-* } 0 } */ -/* { dg-warning ".\.\.\.. as arguments" "" { target *-*-* } 0 } */ +/* { dg-warning "messages without a matching method signature will be assumed to return .id. and accept .\.\.\.. as arguments" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/objc.dg/class-protocol-1.m b/gcc/testsuite/objc.dg/class-protocol-1.m index 086201eef52..59c8f827615 100644 --- a/gcc/testsuite/objc.dg/class-protocol-1.m +++ b/gcc/testsuite/objc.dg/class-protocol-1.m @@ -436,6 +436,4 @@ int main () return(0); } -/* { dg-warning "Messages without a matching method signature" "" { target *-*-* } 0 } */ -/* { dg-warning "will be assumed to return .id. and accept" "" { target *-*-* } 0 } */ -/* { dg-warning ".\.\.\.. as arguments" "" { target *-*-* } 0 } */ +/* { dg-warning "messages without a matching method signature will be assumed to return .id. and accept .\.\.\.. as arguments" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/objc.dg/desig-init-1.m b/gcc/testsuite/objc.dg/desig-init-1.m index 24fe7094eae..e5d5a595e91 100644 --- a/gcc/testsuite/objc.dg/desig-init-1.m +++ b/gcc/testsuite/objc.dg/desig-init-1.m @@ -44,8 +44,4 @@ int main(void) { return 0; } -/* { dg-warning "Messages without a matching method signature" "" { target *-*-* } 0 } */ -/* { dg-warning "will be assumed to return .id. and accept" "" { target *-*-* } 0 } */ -/* { dg-warning ".\.\.\.. as arguments" "" { target *-*-* } 0 } */ - - +/* { dg-warning "messages without a matching method signature will be assumed to return .id. and accept .\.\.\.. as arguments" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/objc.dg/exceptions-3.m b/gcc/testsuite/objc.dg/exceptions-3.m index 5548a39a08c..69a6494e048 100644 --- a/gcc/testsuite/objc.dg/exceptions-3.m +++ b/gcc/testsuite/objc.dg/exceptions-3.m @@ -27,19 +27,19 @@ int test (id object) int dummy = 0; @try { @throw object; } - @catch (int x) /* { dg-error "@catch parameter is not a known Objective-C class type" } */ + @catch (int x) /* { dg-error "'@catch' parameter is not a known Objective-C class type" } */ { dummy++; } @try { @throw object; } - @catch (intTypedef x) /* { dg-error "@catch parameter is not a known Objective-C class type" } */ + @catch (intTypedef x) /* { dg-error "'@catch' parameter is not a known Objective-C class type" } */ { dummy++; } @try { @throw object; } - @catch (int *x) /* { dg-error "@catch parameter is not a known Objective-C class type" } */ + @catch (int *x) /* { dg-error "'@catch' parameter is not a known Objective-C class type" } */ { dummy++; } @@ -51,7 +51,7 @@ int test (id object) } @try { @throw object; } - @catch (id x) /* { dg-error "@catch parameter cannot be protocol-qualified" } */ + @catch (id x) /* { dg-error "'@catch' parameter cannot be protocol-qualified" } */ { dummy++; } @@ -63,13 +63,13 @@ int test (id object) } @try { @throw object; } - @catch (MyObject *x) /* { dg-error "@catch parameter cannot be protocol-qualified" } */ + @catch (MyObject *x) /* { dg-error "'@catch' parameter cannot be protocol-qualified" } */ { dummy++; } @try { @throw object; } - @catch (MyObject x) /* { dg-error "@catch parameter is not a known Objective-C class type" } */ + @catch (MyObject x) /* { dg-error "'@catch' parameter is not a known Objective-C class type" } */ { /* { dg-error "conversion to non-scalar type requested" "" { target *-*-* } .-1 } */ dummy++; } @@ -87,7 +87,7 @@ int test (id object) } @try { @throw object; } - @catch (MyObjectTypedef *x) /* { dg-error "@catch parameter cannot be protocol-qualified" } */ + @catch (MyObjectTypedef *x) /* { dg-error "'@catch' parameter cannot be protocol-qualified" } */ { dummy++; } @@ -99,7 +99,7 @@ int test (id object) } @try { @throw object; } - @catch (Class x) /* { dg-error "@catch parameter is not a known Objective-C class type" } */ + @catch (Class x) /* { dg-error "'@catch' parameter is not a known Objective-C class type" } */ { dummy++; } diff --git a/gcc/testsuite/objc.dg/exceptions-4.m b/gcc/testsuite/objc.dg/exceptions-4.m index 5db60e34aca..bbdb741f40b 100644 --- a/gcc/testsuite/objc.dg/exceptions-4.m +++ b/gcc/testsuite/objc.dg/exceptions-4.m @@ -44,7 +44,7 @@ int test (id object) dummy++; } @catch (id ) /* { dg-error "@catch parameter cannot be protocol-qualified" } */ + @catch (id ) /* { dg-error "'@catch' parameter cannot be protocol-qualified" } */ { dummy++; } @@ -63,13 +63,13 @@ int test (id object) } @try { @throw object; } - @catch (MyObject *) /* { dg-error "@catch parameter cannot be protocol-qualified" } */ + @catch (MyObject *) /* { dg-error "'@catch' parameter cannot be protocol-qualified" } */ { dummy++; } @try { @throw object; } - @catch (MyObject) /* { dg-error "@catch parameter is not a known Objective-C class type" } */ + @catch (MyObject) /* { dg-error "'@catch' parameter is not a known Objective-C class type" } */ { /* { dg-error "conversion to non-scalar type requested" "" { target *-*-* } .-1 } */ dummy++; } @@ -87,7 +87,7 @@ int test (id object) } @try { @throw object; } - @catch (MyObjectTypedef *) /* { dg-error "@catch parameter cannot be protocol-qualified" } */ + @catch (MyObjectTypedef *) /* { dg-error "'@catch' parameter cannot be protocol-qualified" } */ { dummy++; } @@ -99,7 +99,7 @@ int test (id object) } @try { @throw object; } - @catch (Class) /* { dg-error "@catch parameter is not a known Objective-C class type" } */ + @catch (Class) /* { dg-error "'@catch' parameter is not a known Objective-C class type" } */ { dummy++; } diff --git a/gcc/testsuite/objc.dg/exceptions-6.m b/gcc/testsuite/objc.dg/exceptions-6.m index 74be98d39fa..ae44a88e436 100644 --- a/gcc/testsuite/objc.dg/exceptions-6.m +++ b/gcc/testsuite/objc.dg/exceptions-6.m @@ -9,7 +9,7 @@ void test (id object) { @throw object; /* Ok */ - @throw; /* { dg-error ".@throw. .rethrow. used outside of a @catch block" } */ + @throw; /* { dg-error ".@throw. .rethrow. used outside of a '@catch' block" } */ @throw (object); /* Ok. */ @throw (id)0 /* { dg-error "expected" } */ } diff --git a/gcc/testsuite/objc.dg/method-19.m b/gcc/testsuite/objc.dg/method-19.m index 8f60511f788..8e354bbd1ba 100644 --- a/gcc/testsuite/objc.dg/method-19.m +++ b/gcc/testsuite/objc.dg/method-19.m @@ -8,11 +8,9 @@ @class NotKnown; void foo(NotKnown *n) { - [NotKnown new]; /* { dg-warning ".interface of class .NotKnown. not found" } */ - [n nonexistent_method]; /* { dg-warning ".interface of class .NotKnown. not found" } */ + [NotKnown new]; /* { dg-warning "'.interface' of class .NotKnown. not found" } */ + [n nonexistent_method]; /* { dg-warning "'.interface' of class .NotKnown. not found" } */ /* { dg-warning "no .\\-nonexistent_method. method found" "" { target *-*-* } .-1 } */ } -/* { dg-warning "Messages without a matching method signature" "" { target *-*-* } 0 } */ -/* { dg-warning "will be assumed to return .id. and accept" "" { target *-*-* } 0 } */ -/* { dg-warning ".\.\.\.. as arguments" "" { target *-*-* } 0 } */ +/* { dg-warning "Messages without a matching method signature will be assumed to return .id. and accept .\.\.\.. as arguments" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/objc.dg/method-2.m b/gcc/testsuite/objc.dg/method-2.m index b6aa32d4f29..cae2d7ff6f7 100644 --- a/gcc/testsuite/objc.dg/method-2.m +++ b/gcc/testsuite/objc.dg/method-2.m @@ -23,9 +23,7 @@ [MyIntermediate rootInstanceMethod]; /* with the same name. */ [self instanceMethod]; /* { dg-warning ".MyDerived. may not respond to .\\+instanceMethod." } */ - /* { dg-warning "Messages without a matching method signature" "" { target *-*-* } .-1 } */ - /* { dg-warning "will be assumed to return .id. and accept" "" { target *-*-* } .-2 } */ - /* { dg-warning ".\.\.\.. as arguments" "" { target *-*-* } .-3 } */ + /* { dg-warning "messages without a matching method signature will be assumed to return .id. and accept .\.\.\.. as arguments" "" { target *-*-* } 0 } */ [MyDerived instanceMethod]; /* { dg-warning ".MyDerived. may not respond to .\\+instanceMethod." } */ } @end diff --git a/gcc/testsuite/objc.dg/method-5.m b/gcc/testsuite/objc.dg/method-5.m index 89409143e14..277a7e9e223 100644 --- a/gcc/testsuite/objc.dg/method-5.m +++ b/gcc/testsuite/objc.dg/method-5.m @@ -11,12 +11,10 @@ void foo(UnderSpecified *u, NotAClass *n) { [n nonexistent_method]; /* { dg-warning "invalid receiver type" } */ /* { dg-warning "no .\\-nonexistent_method. method found" "" { target *-*-* } .-1 } */ [NotAClass nonexistent_method]; /* { dg-error ".NotAClass. is not an Objective\\-C class name or alias" } */ - [u nonexistent_method]; /* { dg-warning ".interface of class .UnderSpecified. not found" } */ + [u nonexistent_method]; /* { dg-warning "'.interface' of class .UnderSpecified. not found" } */ /* { dg-warning "no .\\-nonexistent_method. method found" "" { target *-*-* } .-1 } */ - [UnderSpecified nonexistent_method]; /* { dg-warning ".interface of class .UnderSpecified. not found" } */ + [UnderSpecified nonexistent_method]; /* { dg-warning "'.interface' of class .UnderSpecified. not found" } */ /* { dg-warning "no .\\+nonexistent_method. method found" "" { target *-*-* } .-1 } */ } -/* { dg-warning "Messages without a matching method signature" "" { target *-*-* } 0 } */ -/* { dg-warning "will be assumed to return .id. and accept" "" { target *-*-* } 0 } */ -/* { dg-warning ".\.\.\.. as arguments" "" { target *-*-* } 0 } */ +/* { dg-warning "messages without a matching method signature will be assumed to return .id. and accept .\.\.\.. as arguments" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/objc.dg/method-6.m b/gcc/testsuite/objc.dg/method-6.m index 35676b18f06..3ff73e0e9ca 100644 --- a/gcc/testsuite/objc.dg/method-6.m +++ b/gcc/testsuite/objc.dg/method-6.m @@ -31,9 +31,7 @@ void foo(void) { /* { dg-message "also found .\\+\\(Protocol \\*\\)port." "" { target *-*-* } Derived_port_last } */ [receiver starboard]; /* { dg-warning "no .\\+starboard. method found" } */ - /* { dg-warning "Messages without a matching method signature" "" { target *-*-* } .-1 } */ - /* { dg-warning "will be assumed to return .id. and accept" "" { target *-*-* } .-2 } */ - /* { dg-warning ".\.\.\.. as arguments" "" { target *-*-* } .-3 } */ + /* { dg-warning "messages without a matching method signature will be assumed to return .id. and accept .\.\.\.. as arguments" "" { target *-*-* } 0 } */ [Class port]; /* { dg-error ".Class. is not an Objective\\-C class name or alias" } */ } diff --git a/gcc/testsuite/objc.dg/method-7.m b/gcc/testsuite/objc.dg/method-7.m index a5957aedbaa..314e8abaf89 100644 --- a/gcc/testsuite/objc.dg/method-7.m +++ b/gcc/testsuite/objc.dg/method-7.m @@ -18,9 +18,7 @@ id foo(void) { TestsuiteObject *obj = [[TestsuiteObject alloc] init]; id obj2 = obj; [obj setWindow:nil]; /* { dg-warning ".TestsuiteObject. may not respond to .\\-setWindow:." } */ - /* { dg-warning "Messages without a matching method signature" "" { target *-*-* } .-1 } */ - /* { dg-warning "will be assumed to return .id. and accept" "" { target *-*-* } .-2 } */ - /* { dg-warning ".\.\.\.. as arguments" "" { target *-*-* } .-3 } */ + /* { dg-warning "messages without a matching method signature will be assumed to return .id. and accept .\.\.\.. as arguments" "" { target *-*-* } 0 } */ [obj2 setWindow:nil]; /* { dg-warning "multiple methods named .\\-setWindow:. found" } */ /* { dg-message "using .\\-\\(void\\)setWindow:\\(TestsuiteObject \\*\\)wdw." "" { target *-*-* } Class1_setWindow } */ /* { dg-message "also found .\\-\\(void\\)setWindow:\\(Class1 \\*\\)window." "" { target *-*-* } Class2_setWindow } */ diff --git a/gcc/testsuite/objc.dg/method-lookup-1.m b/gcc/testsuite/objc.dg/method-lookup-1.m index 47499c37c08..e458471ff2c 100644 --- a/gcc/testsuite/objc.dg/method-lookup-1.m +++ b/gcc/testsuite/objc.dg/method-lookup-1.m @@ -39,7 +39,7 @@ void test (Class x, Class y, id w, id z, NotKnown *a, /* If a class is specified by name, the @interface must be available to check what it responds to. */ - [NotKnown classMethod]; /* { dg-warning ".interface of class .NotKnown. not found" } */ + [NotKnown classMethod]; /* { dg-warning "'.interface' of class .NotKnown. not found" } */ /* "id w" means that "w" responds to anything, both class and @@ -70,7 +70,7 @@ void test (Class x, Class y, id w, id z, NotKnown *a, because they expect the compiler to do type-checking; the @interface must be available to do this check, otherwise the compiler does not know what "a" responds to. */ - [a instanceMethod]; /* { dg-warning ".interface of class .NotKnown. not found" } */ + [a instanceMethod]; /* { dg-warning "'.interface' of class .NotKnown. not found" } */ /* But, if you cast it to "id", then you're disabling type-checking and the warnings should go away. */ diff --git a/gcc/testsuite/objc.dg/proto-hier-1.m b/gcc/testsuite/objc.dg/proto-hier-1.m index fbd00f8d8ae..0f409fc69ed 100644 --- a/gcc/testsuite/objc.dg/proto-hier-1.m +++ b/gcc/testsuite/objc.dg/proto-hier-1.m @@ -53,6 +53,4 @@ int foo(void) { return 0; } -/* { dg-warning "Messages without a matching method signature" "" { target *-*-* } 0 } */ -/* { dg-warning "will be assumed to return .id. and accept" "" { target *-*-* } 0 } */ -/* { dg-warning ".\.\.\.. as arguments" "" { target *-*-* } 0 } */ +/* { dg-warning "messages without a matching method signature will be assumed to return .id. and accept .\.\.\.. as arguments" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/objc.dg/proto-lossage-4.m b/gcc/testsuite/objc.dg/proto-lossage-4.m index 182e92d94b2..9d1def5f9de 100644 --- a/gcc/testsuite/objc.dg/proto-lossage-4.m +++ b/gcc/testsuite/objc.dg/proto-lossage-4.m @@ -49,6 +49,4 @@ long foo(void) { return receiver; } -/* { dg-warning "Messages without a matching method signature" "" { target *-*-* } 0 } */ -/* { dg-warning "will be assumed to return .id. and accept" "" { target *-*-* } 0 } */ -/* { dg-warning ".\.\.\.. as arguments" "" { target *-*-* } 0 } */ +/* { dg-warning "messages without a matching method signature will be assumed to return .id. and accept .\.\.\.. as arguments" "" { target *-*-* } 0 } */ From patchwork Tue May 14 21:33:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Sebor X-Patchwork-Id: 1099746 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-500694-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="ILM9yuYB"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="auYwi2Nx"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 453WCl4c7dz9sNQ for ; Wed, 15 May 2019 07:34:11 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=NQaooAR+PokMrLswFkOYRLTKAXlS2vr+5wTQ/AydDWjDfovBUZ e7eDAdJRBJgqQ0CSvI0WqhwPT1qL6Sw/DcFcPY/ie0pV7vyTw1b7gtQbPIJgKS+v qL+Ol48vOlNuBVzVEEO5fSqB2SEHfj+EW7Pb8WUa3xQPLd+aYYwEiNc0k= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=Pif55eglYUJUqnvx5edFBHZ+0m0=; b=ILM9yuYBPJR20qmHX5oI C03x36QUArAB6w6El2hNFrkBMbclMWnd1tD32mBzzjYsDIHLv/v8xWv8XOSnyzRh 888XMbj/MqlgnstRTOQfOqWUtzYKONFbw34zAzFIg7f9HcmGtmTUaORWp0noLPnR E7Bto6HKIAFwt4dVPLTKOLk= Received: (qmail 43232 invoked by alias); 14 May 2019 21:33:10 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 43181 invoked by uid 89); 14 May 2019 21:33:09 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.5 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS, T_FILL_THIS_FORM_SHORT autolearn=ham version=3.3.1 spammy= X-HELO: mail-qk1-f179.google.com Received: from mail-qk1-f179.google.com (HELO mail-qk1-f179.google.com) (209.85.222.179) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 14 May 2019 21:33:06 +0000 Received: by mail-qk1-f179.google.com with SMTP id w20so209623qka.7 for ; Tue, 14 May 2019 14:33:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:date:user-agent:mime-version :content-language; bh=FN+v1QX4IbjwOinYiPtIqeSMlaeDV2TYG3hUQuiOkMg=; b=auYwi2NxlyYSW2yerUWg5uBI1J35KGTqM5Bj4New3c1k7axxyV6eFQ6/ZpNqOHMygM YWFWz9z1C6Amj4ged3uiO29YqvKvyu8chptQh+MtHwBVv2x6N3Q+XMmeIvTMi1hgo19Z DtiXqoDjzUsKoU7ejcEfkulof+mCLcv6eKLEfOLvGSpp10ssGy8nohVfUJJJVBfDRPvg /X40tukBTUL01bSrKMzlYbN/tnYL1e+soo8mYOKx+NlsX/+f0Bycgz2P5gSWaW1+CAKU 6KlWcdrljmYTwTePCdLQFutkJF+rp0gJXO6QbL7GsqjgMCGeTdJhjUMTDv6RMs3E6SiV FzYA== Received: from [192.168.0.41] (97-118-125-210.hlrn.qwest.net. [97.118.125.210]) by smtp.gmail.com with ESMTPSA id b22sm105895qtc.37.2019.05.14.14.33.03 for (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Tue, 14 May 2019 14:33:04 -0700 (PDT) To: gcc-patches From: Martin Sebor Subject: [PATCH 10/12] fix diagnostic quoting/spelling in D Message-ID: <84117ded-97b1-5539-6d6e-c0ac653d5d69@gmail.com> Date: Tue, 14 May 2019 15:33:03 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 MIME-Version: 1.0 X-IsSubscribed: yes The attached patch fixes quoting, spelling, and other formatting issues in diagnostics issued by the D front end and pointed out by the -Wformat-diag warning. Martin gcc/d/ChangeLog: * d/d-builtins.cc (d_init_builtins): Quote keywords, operators, and types in diagnostics. * d/d-codegen.cc (get_array_length): Same. Replace can't with cannot. * d/d-convert.cc (convert_expr): Same. * d/d-frontend.cc (getTypeInfoType): Quote an option name in a diagnostic. * d/d-lang.cc (d_handle_option): Same. (d_parse_file): Same. * d/decl.cc: Remove a trailing period from a diagnostic. * d/expr.cc: Use a directive for an apostrophe. * d/toir.cc: Quote keywords, operators, and types in diagnostics. * d/typeinfo.cc (build_typeinfo): Quote an option name in a diagnostic. diff --git a/gcc/d/d-builtins.cc b/gcc/d/d-builtins.cc index 3dbdafb492a..3ebee721a25 100644 --- a/gcc/d/d-builtins.cc +++ b/gcc/d/d-builtins.cc @@ -1117,7 +1117,7 @@ d_init_builtins (void) Type::tvalist = build_frontend_type (va_list_type_node); if (!Type::tvalist) { - error ("cannot represent built-in va_list type in D"); + error ("cannot represent built-in % type in D"); gcc_unreachable (); } diff --git a/gcc/d/d-codegen.cc b/gcc/d/d-codegen.cc index 2abff92fc88..1971064e334 100644 --- a/gcc/d/d-codegen.cc +++ b/gcc/d/d-codegen.cc @@ -316,7 +316,7 @@ get_array_length (tree exp, Type *type) return d_array_length (exp); default: - error ("can't determine the length of a %qs", type->toChars ()); + error ("cannot determine the length of a %qs", type->toChars ()); return error_mark_node; } } diff --git a/gcc/d/d-convert.cc b/gcc/d/d-convert.cc index e9aa457d852..b020eab902f 100644 --- a/gcc/d/d-convert.cc +++ b/gcc/d/d-convert.cc @@ -376,7 +376,7 @@ convert_expr (tree exp, Type *etype, Type *totype) } else { - error ("can't convert a delegate expression to %qs", + error ("cannot convert a delegate expression to %qs", totype->toChars ()); return error_mark_node; } @@ -392,7 +392,7 @@ convert_expr (tree exp, Type *etype, Type *totype) } else { - error ("can't convert struct %qs to %qs", + error ("cannot convert struct %qs to %qs", etype->toChars (), totype->toChars ()); return error_mark_node; } @@ -475,7 +475,7 @@ convert_expr (tree exp, Type *etype, Type *totype) if ((dim * esize) % tsize != 0) { - error ("cannot cast %qs to %qs since sizes don't line up", + error ("cannot cast %qs to %qs since sizes do not line up", etype->toChars (), totype->toChars ()); return error_mark_node; } diff --git a/gcc/d/d-frontend.cc b/gcc/d/d-frontend.cc index ccd5f50130f..77b6f22d824 100644 --- a/gcc/d/d-frontend.cc +++ b/gcc/d/d-frontend.cc @@ -625,7 +625,7 @@ getTypeInfoType (Loc loc, Type *type, Scope *sc) if (!warned) { error_at (make_location_t (loc), - "% cannot be used with -fno-rtti"); + "% cannot be used with %<-fno-rtti%>"); warned = 1; } } diff --git a/gcc/d/d-lang.cc b/gcc/d/d-lang.cc index 62a8ddd69b2..f23f719a2c3 100644 --- a/gcc/d/d-lang.cc +++ b/gcc/d/d-lang.cc @@ -449,7 +449,7 @@ d_handle_option (size_t scode, const char *arg, HOST_WIDE_INT value, break; } - error ("bad argument for -fdebug %qs", arg); + error ("bad argument for %<-fdebug%>: %qs", arg); break; case OPT_fdoc: @@ -497,7 +497,7 @@ d_handle_option (size_t scode, const char *arg, HOST_WIDE_INT value, case OPT_fmodule_file_: global.params.modFileAliasStrings->push (arg); if (!strchr (arg, '=')) - error ("bad argument for -fmodule-file %qs", arg); + error ("bad argument for %<-fmodule-file%>: %qs", arg); break; case OPT_fmoduleinfo: @@ -588,7 +588,7 @@ d_handle_option (size_t scode, const char *arg, HOST_WIDE_INT value, break; } - error ("bad argument for -fversion %qs", arg); + error ("bad argument for %<-fversion%>: %qs", arg); break; case OPT_H: @@ -1011,7 +1011,7 @@ d_parse_file (void) /* In this mode, the first file name is supposed to be a duplicate of one of the input files. */ if (d_option.fonly && strcmp (d_option.fonly, main_input_filename) != 0) - error ("-fonly= argument is different from first input file name"); + error ("%<-fonly=%> argument is different from first input file name"); for (size_t i = 0; i < num_in_fnames; i++) { diff --git a/gcc/d/decl.cc b/gcc/d/decl.cc index 49723649230..bcce245e59c 100644 --- a/gcc/d/decl.cc +++ b/gcc/d/decl.cc @@ -463,7 +463,7 @@ public: fd2->toPrettyChars ()); inform (make_location_t (d->loc), "use % to introduce base class " - "overload set.", fd->toChars (), + "overload set", fd->toChars (), fd->parent->toChars (), fd->toChars ()); } else diff --git a/gcc/d/expr.cc b/gcc/d/expr.cc index 6497619e5fd..826c32a059f 100644 --- a/gcc/d/expr.cc +++ b/gcc/d/expr.cc @@ -1522,7 +1522,7 @@ public: } else { - error ("don't know how to delete %qs", e->e1->toChars ()); + error ("don%'t know how to delete %qs", e->e1->toChars ()); this->result_ = error_mark_node; } } diff --git a/gcc/d/toir.cc b/gcc/d/toir.cc index f1b2e09a94d..1d125b43962 100644 --- a/gcc/d/toir.cc +++ b/gcc/d/toir.cc @@ -367,9 +367,11 @@ public: } if (ent->in_try_scope) - error_at (make_location_t (from->loc), "cannot goto into try block"); + error_at (make_location_t (from->loc), + "cannot % into % block"); else if (ent->in_catch_scope) - error_at (make_location_t (from->loc), "cannot goto into catch block"); + error_at (make_location_t (from->loc), + "cannot % into % block"); } /* Check that a previously seen jump to a newly defined label is valid. @@ -391,21 +393,21 @@ public: { location = make_location_t (fwdref->statement->loc); if (b->kind == level_try) - error_at (location, "cannot goto into try block"); + error_at (location, "cannot % into % block"); else - error_at (location, "cannot goto into catch block"); + error_at (location, "cannot % into % block"); } else if (s->isCaseStatement ()) { location = make_location_t (s->loc); error_at (location, "case cannot be in different " - "try block level from switch"); + "% block level from %"); } else if (s->isDefaultStatement ()) { location = make_location_t (s->loc); error_at (location, "default cannot be in different " - "try block level from switch"); + "% block level from %"); } else gcc_unreachable (); @@ -1125,8 +1127,8 @@ public: static int warned = 0; if (!warned) { - error_at (make_location_t (s->loc), "exception handling disabled, " - "use -fexceptions to enable"); + error_at (make_location_t (s->loc), "exception handling disabled; " + "use %<-fexceptions%> to enable"); warned = 1; } } diff --git a/gcc/d/typeinfo.cc b/gcc/d/typeinfo.cc index bbd3961181d..58c6ce1ba3c 100644 --- a/gcc/d/typeinfo.cc +++ b/gcc/d/typeinfo.cc @@ -1350,7 +1350,7 @@ build_typeinfo (const Loc &loc, Type *type) if (!warned) { error_at (make_location_t (loc), - "% cannot be used with -fno-rtti"); + "% cannot be used with %<-fno-rtti%>"); warned = 1; } } From patchwork Tue May 14 21:33:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Sebor X-Patchwork-Id: 1099748 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-500696-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="ilIYBXcU"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="OjQsCk+C"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 453WDX2VN9z9sDn for ; Wed, 15 May 2019 07:34:52 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=kU6+Rkpx8D07Y4vfFb2qQ4lDhG7lTNpyawEFyGXDxJa0rmNGRt 9ZWUXtuDSKbtz16AvFslhmdGGJSAc3tpZ8gbcDAKFENxCVGjnBy2c6mQ1FXQ1Xp5 oAfVrRchmJKoNjaCyXCw5rtTbFc0olx5Yl/jR0eByNjwRnPJr7Su4PPvE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=YtDR20yOyw7qqX5LdqTrl+s0MpE=; b=ilIYBXcUdvdQC5TAiNK2 gue3CiP2eqLoCEvlANLRB0WGA9Ac/5fPX6katMmFCDSpjpVz8G82Jfgai+b6e55W YLep84ATuR9gNPYkTREbN0zzO/9nQA//cpnw3uT+KmymL0/Yp+0zobrd12hCwLH5 d8BFQHspg8h4DpempNYH/bk= Received: (qmail 43932 invoked by alias); 14 May 2019 21:33:17 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 43884 invoked by uid 89); 14 May 2019 21:33:16 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.9 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=RELEASE, UD:i386-features.c, i386-features.c, i386featuresc X-HELO: mail-qt1-f171.google.com Received: from mail-qt1-f171.google.com (HELO mail-qt1-f171.google.com) (209.85.160.171) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 14 May 2019 21:33:14 +0000 Received: by mail-qt1-f171.google.com with SMTP id i26so834856qtr.10 for ; Tue, 14 May 2019 14:33:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:date:user-agent:mime-version :content-language; bh=7OJZMW/yMAfMvjb0a7K15muQoqVjTCRs63Fkhd1dF44=; b=OjQsCk+CB+z28Xex/ptz6NCQRROaSHEJapWDm4dTv1tgDbRXBC42Umjw7opa7jt34F sRZ1T9OZpI4PXL4Xg31JvyG2FIeqQGjfIQGz/LupVYTDEkegELxtuynNjc++Y8eQdzcM wUJVeLXEEyDW+fGKYDYN2TDPUOxNZ7PrBEqwRrQ7S4wLmhB+LeWqmplOyFf5x6R5O/dk 4zT+Rt5bmXYFlSjefhjVmCGU2rOGgBvbkQOpAXFpqzng0ZbMO8dU9SLy7z//kwkVEQjS pFEkaIA6bD5dff7ngahC+jwjIFoFFe+Kurpg6kmOXzJ9eCc8ekrWFGAh7YMdo4B6K/Uq Sciw== Received: from [192.168.0.41] (97-118-125-210.hlrn.qwest.net. [97.118.125.210]) by smtp.gmail.com with ESMTPSA id f127sm10726338qkb.53.2019.05.14.14.33.11 for (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Tue, 14 May 2019 14:33:11 -0700 (PDT) To: gcc-patches From: Martin Sebor Subject: [PATCH 11/12] fix diagnostic quoting/spelling issues in i386 back-end Message-ID: <50e6af79-64bd-a660-f101-7f7da1aad6b6@gmail.com> Date: Tue, 14 May 2019 15:33:10 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 MIME-Version: 1.0 X-IsSubscribed: yes The attached patch fixes quoting, spelling, and other formatting issues in diagnostics issued by the i386 back-end and pointed out by the -Wformat-diag warning. Martin gcc/ChangeLog: * config/i386/i386-expand.c (get_element_number): Quote keywords and other internal names in diagnostics. Adjust other diagnostic formatting issues noted by -Wformat-diag. * config/i386/i386-features.c (ix86_mangle_function_version_assembler_name): Same. * config/i386/i386-options.c (ix86_handle_abi_attribute): Same. * config/i386/i386.c (ix86_function_type_abi): Same. (ix86_function_ms_hook_prologue): Same. (classify_argument): Same. (ix86_expand_prologue): Same. (ix86_md_asm_adjust): Same. (ix86_memmodel_check): Same. diff --git a/gcc/config/i386/i386-expand.c b/gcc/config/i386/i386-expand.c index a55d4923be4..f96f079ee30 100644 --- a/gcc/config/i386/i386-expand.c +++ b/gcc/config/i386/i386-expand.c @@ -10630,7 +10630,8 @@ get_element_number (tree vec_type, tree arg) if (!tree_fits_uhwi_p (arg) || (elt = tree_to_uhwi (arg), elt > max)) { - error ("selector must be an integer constant in the range 0..%wi", max); + error ("selector must be an integer constant in the range " + "[0, %wi]", max); return 0; } diff --git a/gcc/config/i386/i386-features.c b/gcc/config/i386/i386-features.c index 67f45d66c48..60a120f4df7 100644 --- a/gcc/config/i386/i386-features.c +++ b/gcc/config/i386/i386-features.c @@ -2447,7 +2447,7 @@ ix86_mangle_function_version_assembler_name (tree decl, tree id) && lookup_attribute ("gnu_inline", DECL_ATTRIBUTES (decl))) error_at (DECL_SOURCE_LOCATION (decl), - "function versions cannot be marked as gnu_inline," + "function versions cannot be marked as %," " bodies have to be generated"); if (DECL_VIRTUAL_P (decl) diff --git a/gcc/config/i386/i386-options.c b/gcc/config/i386/i386-options.c index dec8352143c..7c8ddbee0f7 100644 --- a/gcc/config/i386/i386-options.c +++ b/gcc/config/i386/i386-options.c @@ -3462,7 +3462,8 @@ ix86_handle_abi_attribute (tree *node, tree name, tree, int, { if (lookup_attribute ("sysv_abi", TYPE_ATTRIBUTES (*node))) { - error ("ms_abi and sysv_abi attributes are not compatible"); + error ("%qs and %qs attributes are not compatible", + "ms_abi", "sysv_abi"); } return NULL_TREE; @@ -3471,7 +3472,8 @@ ix86_handle_abi_attribute (tree *node, tree name, tree, int, { if (lookup_attribute ("ms_abi", TYPE_ATTRIBUTES (*node))) { - error ("ms_abi and sysv_abi attributes are not compatible"); + error ("%qs and %qs attributes are not compatible", + "ms_abi", "sysv_abi"); } return NULL_TREE; diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index cc0ae3fcfd3..93ed940eb9e 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -1525,7 +1525,7 @@ ix86_function_type_abi (const_tree fntype) static int warned; if (TARGET_X32 && !warned) { - error ("X32 does not support ms_abi attribute"); + error ("X32 does not support % attribute"); warned = 1; } @@ -1559,7 +1559,8 @@ ix86_function_ms_hook_prologue (const_tree fn) { if (decl_function_context (fn) != NULL_TREE) error_at (DECL_SOURCE_LOCATION (fn), - "ms_hook_prologue is not compatible with nested function"); + "% attribute is not compatible " + "with nested function"); else return true; } @@ -2266,7 +2267,7 @@ classify_argument (machine_mode mode, const_tree type, { warned = true; inform (input_location, - "the ABI of passing union with long double" + "the ABI of passing union with %" " has changed in GCC 4.4"); } return 0; @@ -2384,7 +2385,7 @@ classify_argument (machine_mode mode, const_tree type, { warned = true; inform (input_location, - "the ABI of passing structure with complex float" + "the ABI of passing structure with %" " member has changed in GCC 4.4"); } classes[1] = X86_64_SSESF_CLASS; @@ -7787,7 +7788,7 @@ ix86_expand_prologue (void) /* Check if profiling is active and we shall use profiling before prologue variant. If so sorry. */ if (crtl->profile && flag_fentry != 0) - sorry ("ms_hook_prologue attribute isn%'t compatible " + sorry ("% attribute is not compatible " "with %<-mfentry%> for 32-bit"); /* In ix86_asm_output_function_label we emitted: @@ -20651,7 +20652,7 @@ ix86_md_asm_adjust (vec &outputs, vec &/*inputs*/, con += 4; if (strchr (con, ',') != NULL) { - error ("alternatives not allowed in asm flag output"); + error ("alternatives not allowed in % flag output"); continue; } @@ -20715,7 +20716,7 @@ ix86_md_asm_adjust (vec &outputs, vec &/*inputs*/, } if (code == UNKNOWN) { - error ("unknown asm flag output %qs", constraints[i]); + error ("unknown % flag output %qs", constraints[i]); continue; } if (invert) @@ -20744,7 +20745,7 @@ ix86_md_asm_adjust (vec &outputs, vec &/*inputs*/, machine_mode dest_mode = GET_MODE (dest); if (!SCALAR_INT_MODE_P (dest_mode)) { - error ("invalid type for asm flag output"); + error ("invalid type for % flag output"); continue; } @@ -21678,13 +21679,15 @@ ix86_memmodel_check (unsigned HOST_WIDE_INT val) if (val & IX86_HLE_ACQUIRE && !(is_mm_acquire (model) || strong)) { warning (OPT_Winvalid_memory_model, - "HLE_ACQUIRE not used with ACQUIRE or stronger memory model"); + "% not used with % or stronger " + "memory model"); return MEMMODEL_SEQ_CST | IX86_HLE_ACQUIRE; } if (val & IX86_HLE_RELEASE && !(is_mm_release (model) || strong)) { warning (OPT_Winvalid_memory_model, - "HLE_RELEASE not used with RELEASE or stronger memory model"); + "% not used with % or stronger " + "memory model"); return MEMMODEL_SEQ_CST | IX86_HLE_RELEASE; } return val; From patchwork Tue May 14 21:33:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Sebor X-Patchwork-Id: 1099749 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-500697-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="U6g7XA2z"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="If7sIoi8"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 453WDq0c8pz9sDn for ; Wed, 15 May 2019 07:35:06 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=mFW/a1yzL0nypO3xRvylWZtC6NL5hNmR2T7Y0ej3nPZrA8Sgm0 eN4qjzbNbkQ02zqAvZAYrtsia4LuCwmbHNVtuzphwXRxDa1oDBymu714iKTEgwX2 swVkicpEaItZMHSur7dbPHhFsE0pB1a5vl1Mw3jBCr9MNgK0FHQgjFybY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=Q8bd+XXiALWEnyVfNnoLCoqtHms=; b=U6g7XA2zKgFA4MKu7pXY bDU/H2sF3i8o6jyE949pN7o5bASpQ/cvaoP+1ER6W13M/ok+k9SE6mIdCtqH0imZ iO+1MN57QF5nDvCdvFh4rXaTZXBM/3+OokRa91MkMtmahLPx6QrhYChL2L7NEC5/ em3U4+CnFGqzhv9C8B7drXY= Received: (qmail 44630 invoked by alias); 14 May 2019 21:33:24 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 44575 invoked by uid 89); 14 May 2019 21:33:23 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.1 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=Messages X-HELO: mail-qk1-f181.google.com Received: from mail-qk1-f181.google.com (HELO mail-qk1-f181.google.com) (209.85.222.181) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 14 May 2019 21:33:21 +0000 Received: by mail-qk1-f181.google.com with SMTP id k189so240783qkc.0 for ; Tue, 14 May 2019 14:33:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:date:user-agent:mime-version :content-language; bh=9LA1sb/trN1bwPdSMoNkaR5baKbGU2LV5gGOUbTrfDQ=; b=If7sIoi8kjQUKEZ3640p/R7xfG3ZD+zVYTjddiN5BVRExITDtqEOr7UAUuKMTyQ/qf rR+tybg8+pK4VEN5V4c5upgLKvZLnqDzDpo/EENMVpgGP9w21iOfU0t9ktBIMSKQpbi2 Xx/7LGlZGjffPA4AQa40U7ecPB/InmkdOCx/hYQEsPjtIm+RZSvuAW5e1oM6wAEnaZhS bnjminfGFaFT6ufnAtOAlBghlFnkJyeKw2ycP47S6HtX4b3OvO7R58lnUq2b++bW3mCX 0i2bKrlp8decuw6i9t2BMNuU65bY83YpqWQ28CFZZEINpOIWLo7z+Jgz7W7r3ENg4BNW ysdQ== Received: from [192.168.0.41] (97-118-125-210.hlrn.qwest.net. [97.118.125.210]) by smtp.gmail.com with ESMTPSA id t17sm90339qte.66.2019.05.14.14.33.18 for (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Tue, 14 May 2019 14:33:18 -0700 (PDT) To: gcc-patches From: Martin Sebor Subject: [PATCH 12/12] fix diagnostic quoting/spelling issues in ObjC Message-ID: <36f4496d-f0ec-1833-571a-d94b7bf23201@gmail.com> Date: Tue, 14 May 2019 15:33:17 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 MIME-Version: 1.0 X-IsSubscribed: yes The attached patch fixes quoting, spelling, and other formatting issues in diagnostics issued by the Objective C/C++ front-end and pointed out by the -Wformat-diag warning. Martin gcc/objc/ChangeLog: * objc-act.c (objc_begin_catch_clause): Quote keywords and options in diagnostics. (objc_build_throw_stmt): Same. (objc_finish_message_expr): Same. (get_super_receiver): Same. * objc-next-runtime-abi-01.c (objc_next_runtime_abi_01_init): Spell out "less than" in English./ * objc-next-runtime-abi-02.c (objc_next_runtime_abi_02_init): Spell out "greater" in English. diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index 5cf7205c23b..1eb2262b8ec 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -4208,13 +4208,13 @@ objc_begin_catch_clause (tree decl) } else if (!objc_type_valid_for_messaging (type, false)) { - error ("@catch parameter is not a known Objective-C class type"); + error ("%<@catch%> parameter is not a known Objective-C class type"); type = error_mark_node; } else if (TYPE_HAS_OBJC_INFO (TREE_TYPE (type)) && TYPE_OBJC_PROTOCOL_LIST (TREE_TYPE (type))) { - error ("@catch parameter cannot be protocol-qualified"); + error ("%<@catch%> parameter cannot be protocol-qualified"); type = error_mark_node; } else if (POINTER_TYPE_P (type) && objc_is_object_id (TREE_TYPE (type))) @@ -4336,7 +4336,8 @@ objc_build_throw_stmt (location_t loc, tree throw_expr) if (cur_try_context == NULL || cur_try_context->current_catch == NULL) { - error_at (loc, "%<@throw%> (rethrow) used outside of a @catch block"); + error_at (loc, + "%<@throw%> (rethrow) used outside of a %<@catch%> block"); return error_mark_node; } @@ -5411,7 +5412,8 @@ objc_finish_message_expr (tree receiver, tree sel_name, tree method_params, prototype. Emit a warning, then keep going (this will use any method with a matching name, as if the receiver was of type 'Class'). */ - warning (0, "@interface of class %qE not found", class_tree); + warning (0, "%<@interface%> of class %qE not found", + class_tree); } } /* Handle `self' and `super'. */ @@ -5545,7 +5547,7 @@ objc_finish_message_expr (tree receiver, tree sel_name, tree method_params, warning, either include an @interface for the class, or cast the receiver to 'id'. Note that rtype is an IDENTIFIER_NODE at this point. */ - warning (0, "@interface of class %qE not found", rtype); + warning (0, "%<@interface%> of class %qE not found", rtype); } } @@ -5628,11 +5630,9 @@ objc_finish_message_expr (tree receiver, tree sel_name, tree method_params, if (!warn_missing_methods) { warning_at (input_location, - 0, "(Messages without a matching method signature"); - warning_at (input_location, - 0, "will be assumed to return % and accept"); - warning_at (input_location, - 0, "%<...%> as arguments.)"); + 0, "(messages without a matching method signature " + "will be assumed to return % and accept " + "%<...%> as arguments)"); warn_missing_methods = true; } } @@ -8848,7 +8848,7 @@ get_super_receiver (void) } else { - error ("[super ...] must appear in a method context"); + error ("%<[super ...]%> must appear in a method context"); return error_mark_node; } } diff --git a/gcc/objc/objc-next-runtime-abi-01.c b/gcc/objc/objc-next-runtime-abi-01.c index 77d2c374bc0..fa83e64b6a1 100644 --- a/gcc/objc/objc-next-runtime-abi-01.c +++ b/gcc/objc/objc-next-runtime-abi-01.c @@ -150,7 +150,8 @@ objc_next_runtime_abi_01_init (objc_runtime_hooks *rthooks) { warning_at (UNKNOWN_LOCATION, OPT_Wall, "%<-fobjc-sjlj-exceptions%> is the only supported exceptions " - "system for %<-fnext-runtime%> with %<-fobjc-abi-version%> < 2"); + "system for %<-fnext-runtime%> with %<-fobjc-abi-version%> " + "argument less than 2"); } rthooks->initialize = next_runtime_01_initialize; diff --git a/gcc/objc/objc-next-runtime-abi-02.c b/gcc/objc/objc-next-runtime-abi-02.c index a2214195b2c..aa1cbde5010 100644 --- a/gcc/objc/objc-next-runtime-abi-02.c +++ b/gcc/objc/objc-next-runtime-abi-02.c @@ -241,8 +241,10 @@ objc_next_runtime_abi_02_init (objc_runtime_hooks *rthooks) if (flag_objc_exceptions && flag_objc_sjlj_exceptions) { - inform (UNKNOWN_LOCATION, "%<-fobjc-sjlj-exceptions%> is ignored for " - "%<-fnext-runtime%> when %<-fobjc-abi-version%> >= 2"); + inform (UNKNOWN_LOCATION, + "%<-fobjc-sjlj-exceptions%> is ignored for " + "%<-fnext-runtime%> when %<-fobjc-abi-version%> " + "greater than 1"); flag_objc_sjlj_exceptions = 0; }