From patchwork Wed Nov 9 10:05:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 60259 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E33193887F59 for ; Wed, 9 Nov 2022 10:06:08 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 1E7423858D33 for ; Wed, 9 Nov 2022 10:05:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1E7423858D33 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.cz Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id E257E1F92F; Wed, 9 Nov 2022 10:05:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1667988349; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HhTduTq5MM4pqPxofbFNDzM8r+b7iM+B2fqzidnyDt8=; b=gxcUg0kFClelJpmPwEMptcDG+ju8rP7GTxJu6tjpfYOIOu0V2zKiVIviqX+vdpbAn3U7uV aaaRgbvgee8iuh+IF6FxRfBZHoaziwduyDYOVoAUTY6S7Pq7Gr1XD6i7kWh3La0V2vAxSL Lw0hq0vmCnbcT3ler3G4mTefJROZ5jE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1667988349; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HhTduTq5MM4pqPxofbFNDzM8r+b7iM+B2fqzidnyDt8=; b=n969myv17AB7FKLgQoiTeX5Rq0tPz+1uZgI0krzhCXKtf0X1txLUoEK6RbsPHzPjwB+N0F lJ+wnGjdaqIfSaCg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id C8653139F1; Wed, 9 Nov 2022 10:05:49 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id rHoYMH17a2NbCwAAMHmgww (envelope-from ); Wed, 09 Nov 2022 10:05:49 +0000 Message-ID: <7cef042e-aa55-3a8f-e637-1106dcfa1162@suse.cz> Date: Wed, 9 Nov 2022 11:05:49 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 From: =?utf-8?q?Martin_Li=C5=A1ka?= Subject: [PATCH (pushed)] avr: sphinx: port gen-avr-mmcu to RST To: gcc-patches@gcc.gnu.org Content-Language: en-US Cc: chertykov@gmail.com X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" This ports generation of avr-mcus to RST. Pushed, Martin gcc/ChangeLog: * Makefile.in: Add vpath default for .rst files. * config/avr/avr-devices.cc: For port RST. * config/avr/avr-mcus.def: Update path. * config/avr/gen-avr-mmcu-texi.cc: Moved to... * config/avr/gen-avr-mmcu-rst.cc: ...here. * config/avr/t-avr: Update to rst. * doc/gcc/gcc-command-options/machine-dependent-options/avr-mmcu.rst: Re-generate. --- gcc/Makefile.in | 7 ++++ gcc/config/avr/avr-devices.cc | 42 +++++++++---------- gcc/config/avr/avr-mcus.def | 2 +- ...n-avr-mmcu-texi.cc => gen-avr-mmcu-rst.cc} | 33 +++++++-------- gcc/config/avr/t-avr | 6 +-- .../machine-dependent-options/avr-mmcu.rst | 3 +- 6 files changed, 49 insertions(+), 44 deletions(-) rename gcc/config/avr/{gen-avr-mmcu-texi.cc => gen-avr-mmcu-rst.cc} (80%) diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 428078fbcf9..059606c37d5 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -113,6 +113,13 @@ target_objdir := $(toplevel_builddir)/$(target_subdir) # Directory where sources are, from where we are. VPATH = @srcdir@ +# We define a vpath for the sources of the .rst files here because they +# are split between multiple directories and we would rather use one implicit +# pattern rule for everything. +# This vpath could be extended within the Make-lang fragments. + +vpath %.rst $(gcc_docdir) + # -------- # UNSORTED # -------- diff --git a/gcc/config/avr/avr-devices.cc b/gcc/config/avr/avr-devices.cc index aa284217f50..611b35f7a27 100644 --- a/gcc/config/avr/avr-devices.cc +++ b/gcc/config/avr/avr-devices.cc @@ -64,54 +64,54 @@ avr_arch_types[] = }; const avr_arch_info_t -avr_texinfo[] = +avr_rst[] = { { ARCH_AVR1, "This ISA is implemented by the minimal AVR core and supported " "for assembler only." }, { ARCH_AVR2, - "``Classic'' devices with up to 8@tie{}KiB of program memory." }, + "\"Classic\" devices with up to 8 |nbsp| KiB of program memory." }, { ARCH_AVR25, - "``Classic'' devices with up to 8@tie{}KiB of program memory and with " - "the @code{MOVW} instruction." }, + "\"Classic\" devices with up to 8 |nbsp| KiB of program memory and with " + "the ``MOVW`` instruction." }, { ARCH_AVR3, - "``Classic'' devices with 16@tie{}KiB up to 64@tie{}KiB of " + "\"Classic\" devices with 16 |nbsp| KiB up to 64 |nbsp| KiB of " "program memory." }, { ARCH_AVR31, - "``Classic'' devices with 128@tie{}KiB of program memory." }, + "\"Classic\" devices with 128 |nbsp| KiB of program memory." }, { ARCH_AVR35, - "``Classic'' devices with 16@tie{}KiB up to 64@tie{}KiB of " - "program memory and with the @code{MOVW} instruction." }, + "\"Classic\" devices with 16 |nbsp| KiB up to 64 |nbsp| KiB of " + "program memory and with the ``MOVW`` instruction." }, { ARCH_AVR4, - "``Enhanced'' devices with up to 8@tie{}KiB of program memory." }, + "\"Enhanced\" devices with up to 8 |nbsp| KiB of program memory." }, { ARCH_AVR5, - "``Enhanced'' devices with 16@tie{}KiB up to 64@tie{}KiB of " + "\"Enhanced\" devices with 16 |nbsp| KiB up to 64 |nbsp| KiB of " "program memory." }, { ARCH_AVR51, - "``Enhanced'' devices with 128@tie{}KiB of program memory." }, + "\"Enhanced\" devices with 128 |nbsp| KiB of program memory." }, { ARCH_AVR6, - "``Enhanced'' devices with 3-byte PC, i.e.@: with more than 128@tie{}KiB " + "\"Enhanced\" devices with 3-byte PC, i.e.: with more than 128 |nbsp| KiB " "of program memory." }, { ARCH_AVRTINY, - "``TINY'' Tiny core devices with 512@tie{}B up to 4@tie{}KiB of " + "\"TINY\" Tiny core devices with 512 |nbsp| B up to 4 |nbsp| KiB of " "program memory." }, { ARCH_AVRXMEGA2, - "``XMEGA'' devices with more than 8@tie{}KiB and up to 64@tie{}KiB " + "\"XMEGA\" devices with more than 8 |nbsp| KiB and up to 64 |nbsp| KiB " "of program memory." }, { ARCH_AVRXMEGA3, - "``XMEGA'' devices with up to 64@tie{}KiB of combined program memory " + "\"XMEGA\" devices with up to 64 |nbsp| KiB of combined program memory " "and RAM, and with program memory visible in the RAM address space." }, { ARCH_AVRXMEGA4, - "``XMEGA'' devices with more than 64@tie{}KiB and up to 128@tie{}KiB " + "\"XMEGA\" devices with more than 64 |nbsp| KiB and up to 128 |nbsp| KiB " "of program memory." }, { ARCH_AVRXMEGA5, - "``XMEGA'' devices with more than 64@tie{}KiB and up to 128@tie{}KiB " - "of program memory and more than 64@tie{}KiB of RAM." }, + "\"XMEGA\" devices with more than 64 |nbsp| KiB and up to 128 |nbsp| KiB " + "of program memory and more than 64 |nbsp| KiB of RAM." }, { ARCH_AVRXMEGA6, - "``XMEGA'' devices with more than 128@tie{}KiB of program memory." }, + "\"XMEGA\" devices with more than 128 |nbsp| KiB of program memory." }, { ARCH_AVRXMEGA7, - "``XMEGA'' devices with more than 128@tie{}KiB of program memory " - "and more than 64@tie{}KiB of RAM." } + "\"XMEGA\" devices with more than 128 |nbsp| KiB of program memory " + "and more than 64 |nbsp| KiB of RAM." } }; const avr_mcu_t diff --git a/gcc/config/avr/avr-mcus.def b/gcc/config/avr/avr-mcus.def index fa5e6685227..26c38a5c7aa 100644 --- a/gcc/config/avr/avr-mcus.def +++ b/gcc/config/avr/avr-mcus.def @@ -23,7 +23,7 @@ This will regenerate / update the following source files: - - $(srcdir)/doc/avr-mmcu.texi + - $(srcdir)/doc/avr-mmcu.rst After that, rebuild everything and check-in the new sources to the repo. The device list below should be kept in sync with AVR-LibC. diff --git a/gcc/config/avr/gen-avr-mmcu-texi.cc b/gcc/config/avr/gen-avr-mmcu-rst.cc similarity index 80% rename from gcc/config/avr/gen-avr-mmcu-texi.cc rename to gcc/config/avr/gen-avr-mmcu-rst.cc index 0e013e90bd0..19b903c2760 100644 --- a/gcc/config/avr/gen-avr-mmcu-texi.cc +++ b/gcc/config/avr/gen-avr-mmcu-rst.cc @@ -137,11 +137,11 @@ print_mcus (size_t n_mcus) qsort (mcus, n_mcus, sizeof (avr_mcu_t*), comparator); - printf ("@*@var{mcu}@tie{}="); + printf (" :samp:`{mcu}=`"); for (i = 0; i < n_mcus; i++) { - printf (" @code{%s}%s", mcus[i]->name, i == n_mcus-1 ? ".\n\n" : ","); + printf (" ``%s``%s", mcus[i]->name, i == n_mcus-1 ? ".\n\n" : ","); if (i && !strcmp (mcus[i]->name, mcus[i-1]->name)) { @@ -162,20 +162,18 @@ int main (void) size_t i, n_mcus = 0; const avr_mcu_t *mcu; - printf ("@c Copyright (C) 2012-2022 Free Software Foundation, Inc.\n"); - printf ("@c This is part of the GCC manual.\n"); - printf ("@c For copying conditions, see the file " - "gcc/doc/include/fdl.texi.\n\n"); + printf ("..\n"); + printf (" Copyright 1988-2022 Free Software Foundation, Inc.\n"); + printf (" This is part of the GCC manual.\n"); + printf (" For copying conditions, see the copyright.rst file.\n\n"); - printf ("@c This file is generated automatically using\n"); - printf ("@c gcc/config/avr/gen-avr-mmcu-texi.cc from:\n"); - printf ("@c gcc/config/avr/avr-arch.h\n"); - printf ("@c gcc/config/avr/avr-devices.cc\n"); - printf ("@c gcc/config/avr/avr-mcus.def\n\n"); + printf (" This file is generated automatically using\n"); + printf (" gcc/config/avr/gen-avr-mmcu-texi.cc from:\n"); + printf (" gcc/config/avr/avr-arch.h\n"); + printf (" gcc/config/avr/avr-devices.cc\n"); + printf (" gcc/config/avr/avr-mcus.def\n\n"); - printf ("@c Please do not edit manually.\n\n"); - - printf ("@table @code\n\n"); + printf (" Please do not edit manually.\n\n"); for (mcu = avr_mcu_types; mcu->name; mcu++) { @@ -187,9 +185,9 @@ int main (void) print_mcus (n_mcus); n_mcus = 0; - for (i = 0; i < ARRAY_SIZE (avr_texinfo); i++) - if (arch_id == avr_texinfo[i].arch_id) - printf ("@item %s\n%s\n", mcu->name, avr_texinfo[i].texinfo); + for (i = 0; i < ARRAY_SIZE (avr_rst); i++) + if (arch_id == avr_rst[i].arch_id) + printf ("``%s``\n %s\n\n", mcu->name, avr_rst[i].texinfo); } else if (arch_id == (enum avr_arch_id) mcu->arch_id) { @@ -198,7 +196,6 @@ int main (void) } print_mcus (n_mcus); - printf ("@end table\n"); return EXIT_SUCCESS; } diff --git a/gcc/config/avr/t-avr b/gcc/config/avr/t-avr index d7b1751b3b6..8ee31862938 100644 --- a/gcc/config/avr/t-avr +++ b/gcc/config/avr/t-avr @@ -78,10 +78,10 @@ AVR_MCUS = $(srcdir)/config/avr/avr-mcus.def .PHONY: avr-mcus -avr-mcus: $(srcdir)/doc/avr-mmcu.texi ; @true +avr-mcus: $(srcdir)/doc/gcc/gcc-command-options/machine-dependent-options/avr-mmcu.rst ; @true # Make sure that native -mmcu= support is in sync with -mmcu= documentation. -gen-avr-mmcu-texi$(build_exeext): $(srcdir)/config/avr/gen-avr-mmcu-texi.cc \ +gen-avr-mmcu-rst$(build_exeext): $(srcdir)/config/avr/gen-avr-mmcu-rst.cc \ $(AVR_MCUS) $(srcdir)/config/avr/avr-devices.cc \ $(srcdir)/config/avr/avr-arch.h $(CXX_FOR_BUILD) $(CXXFLAGS_FOR_BUILD) $< -o $@ @@ -91,7 +91,7 @@ gen-avr-mmcu-specs$(build_exeext): $(srcdir)/config/avr/gen-avr-mmcu-specs.cc \ $(srcdir)/config/avr/avr-arch.h $(TM_H) $(CXX_FOR_BUILD) $(CXXFLAGS_FOR_BUILD) $< -o $@ $(INCLUDES) -$(srcdir)/doc/avr-mmcu.texi: gen-avr-mmcu-texi$(build_exeext) +$(srcdir)/doc/gcc/gcc-command-options/machine-dependent-options/avr-mmcu.rst: gen-avr-mmcu-rst$(build_exeext) $(RUN_GEN) ./$< > $@ s-device-specs: gen-avr-mmcu-specs$(build_exeext) diff --git a/gcc/doc/gcc/gcc-command-options/machine-dependent-options/avr-mmcu.rst b/gcc/doc/gcc/gcc-command-options/machine-dependent-options/avr-mmcu.rst index df82d0cf906..120f919e331 100644 --- a/gcc/doc/gcc/gcc-command-options/machine-dependent-options/avr-mmcu.rst +++ b/gcc/doc/gcc/gcc-command-options/machine-dependent-options/avr-mmcu.rst @@ -94,4 +94,5 @@ ``avr1`` This ISA is implemented by the minimal AVR core and supported for assembler only. - :samp:`{mcu}=` ``attiny11``, ``attiny12``, ``attiny15``, ``attiny28``, ``at90s1200``. \ No newline at end of file + :samp:`{mcu}=` ``attiny11``, ``attiny12``, ``attiny15``, ``attiny28``, ``at90s1200``. +