gcc/contrib/check-internal-format-escaping.py
Martin Liska 904f3daa02 Remove usage of apostrophes in error and warning messages (PR translation/89935).
2019-04-05  Martin Liska  <mliska@suse.cz>

	PR translation/89935
	* check-internal-format-escaping.py: Properly detect wrong
	apostrophes.
2019-04-05  Martin Liska  <mliska@suse.cz>

	PR translation/89935
	* collect-utils.c (collect_execute): Use %< and %>, or %qs in
	order to wrap keywords or arguments.
	* collect2.c (main): Likewise.
	(scan_prog_file): Likewise.
	(scan_libraries): Likewise.
	* common/config/riscv/riscv-common.c (riscv_subset_list::parsing_subset_version): Likewise.
	(riscv_subset_list::parse_std_ext): Likewise.
	* config/aarch64/aarch64.c (aarch64_override_options_internal): Likewise.
	* config/arm/arm.c (arm_option_override): Likewise.
	* config/cris/cris.c (cris_print_operand): Likewise.
	* config/darwin-c.c (darwin_pragma_options): Likewise.
	(darwin_pragma_unused): Likewise.
	(darwin_pragma_ms_struct): Likewise.
	* config/ft32/ft32.c (ft32_print_operand): Likewise.
	* config/i386/i386.c (print_reg): Likewise.
	(ix86_print_operand): Likewise.
	* config/i386/xm-djgpp.h: Likewise.
	* config/iq2000/iq2000.c (iq2000_print_operand): Likewise.
	* config/m32c/m32c.c (m32c_option_override): Likewise.
	* config/msp430/msp430.c (msp430_option_override): Likewise.
	* config/nds32/nds32.c (nds32_option_override): Likewise.
	* config/nvptx/mkoffload.c (main): Likewise.
	* config/rx/rx.c (rx_print_operand): Likewise.
	(valid_psw_flag): Likewise.
	* config/vms/vms-c.c (vms_pragma_member_alignment): Likewise.
	(vms_pragma_nomember_alignment): Likewise.
	(vms_pragma_extern_model): Likewise.
	* lto-wrapper.c (compile_offload_image): Likewise.
	* omp-offload.c (oacc_parse_default_dims): Likewise.
	* symtab.c (symtab_node::verify_base): Likewise.
	* tlink.c (recompile_files): Likewise.
	(start_tweaking): Likewise.
	* tree-profile.c (parse_profile_filter): Likewise.
2019-04-05  Martin Liska  <mliska@suse.cz>

	PR translation/89935
	* objc-act.c (objc_add_property_declaration): Use %< and %>, or %qs in
	order to wrap keywords or arguments.
	(objc_add_synthesize_declaration_for_property): Likewise.

From-SVN: r270163
2019-04-05 08:37:44 +00:00

65 lines
2.0 KiB
Python
Executable File

#!/usr/bin/env python3
#
# Check gcc.pot file for gcc-internal-format and print all strings
# that contain an option that is not wrapped by %<-option_name%>.
#
# This file is part of GCC.
#
# GCC is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 3, or (at your option) any later
# version.
#
# GCC is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>. */
#
#
#
import argparse
import re
parser = argparse.ArgumentParser(description='')
parser.add_argument('file', help = 'pot file')
args = parser.parse_args()
origin = None
internal = False
lines = open(args.file).readlines()
for i, l in enumerate(lines):
l = l.strip()
s = 'msgid '
if l.startswith('#: '):
origin = l
elif '#, gcc-internal-format' in l:
internal = True
if l.startswith(s) and origin and internal:
j = 0
while not lines[i + j].startswith('msgstr'):
l = lines[i + j]
if l.startswith(s):
l = l[len(s):]
text = l.strip('"').strip()
if text:
parts = text.split(' ')
for p in parts:
if p.startswith('-'):
if len(p) >= 2 and (p[1].isalpha() and p != '-INF'):
print('%s: %s' % (origin, text))
elif p.startswith('__builtin_'):
print('%s: %s' % (origin, text))
if re.search("[^%]'", p):
print('%s: %s' % (origin, text))
j += 1
origin = None
internal = False