public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-10109] v2: DOCUMENTATION_ROOT_URL vs. release branches [PR114738]
@ 2024-04-24 16:31 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2024-04-24 16:31 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:97a54c05b8e338e673e1f7fb72c0e23abb571c60

commit r14-10109-g97a54c05b8e338e673e1f7fb72c0e23abb571c60
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Apr 24 18:29:12 2024 +0200

    v2: DOCUMENTATION_ROOT_URL vs. release branches [PR114738]
    
    This patch moves the documentation root URL infix for release branches
    from get_option_url/make_doc_url to configure, such that only the default
    changes and when users specify a custom documentation root URL, they don't
    have to add gcc-MAJOR.MINOR.0 subdirectories for release branches.
    
    Tested by checking
    ../configure --disable-bootstrap --enable-languages=c --disable-multilib
    built trunk on
    void
    foo (int x)
    {
      __builtin_printf ("%ld\n", x);
    }
    testcase and looking for the URL in there, then repeating that after
    changing gcc/BASE-VER to 14.1.0 and again after changing it to 14.1.1,
    plus normal bootstrap/regtest.
    
    2024-04-24  Jakub Jelinek  <jakub@redhat.com>
    
            PR other/114738
            * opts.cc (get_option_url): Revert 2024-04-17 changes.
            * gcc-urlifier.cc: Don't include diagnostic-core.h.
            (gcc_urlifier::make_doc_url): Revert 2024-04-17 changes.
            * configure.ac (documentation-root-url): On release branches
            append gcc-MAJOR.MINOR.0/ to the default DOCUMENTATION_ROOT_URL.
            * doc/install.texi (--with-documentation-root-url=): Document
            the change of the default.
            * configure: Regenerate.

Diff:
---
 gcc/configure        | 12 +++++++++---
 gcc/configure.ac     | 13 ++++++++++---
 gcc/doc/install.texi |  4 +++-
 gcc/gcc-urlifier.cc  | 12 +-----------
 gcc/opts.cc          | 14 +-------------
 5 files changed, 24 insertions(+), 31 deletions(-)

diff --git a/gcc/configure b/gcc/configure
index 266ab8f84b2..23da7d55d62 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -8232,7 +8232,13 @@ if test "${with_documentation_root_url+set}" = set; then :
       *)   as_fn_error $? "documentation root URL does not end with /" "$LINENO" 5 ;;
      esac
 else
-  DOCUMENTATION_ROOT_URL="https://gcc.gnu.org/onlinedocs/"
+
+     docroot_url_suffix=
+     case "$gcc_version" in
+       *.[123456].0) docroot_url_suffix="gcc-$gcc_version/";;
+       *.[123456].1) docroot_url_suffix="gcc-`echo $gcc_version | sed 's/1$/0/'`/";;
+     esac
+     DOCUMENTATION_ROOT_URL="https://gcc.gnu.org/onlinedocs/$docroot_url_suffix"
 
 fi
 
@@ -21569,7 +21575,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 21572 "configure"
+#line 21578 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -21675,7 +21681,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 21678 "configure"
+#line 21684 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/gcc/configure.ac b/gcc/configure.ac
index a5aec1bc967..d7cf0b92cd8 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -1088,9 +1088,16 @@ AC_ARG_WITH(documentation-root-url,
       no)  AC_MSG_ERROR([documentation root URL not specified]) ;;
       */)  DOCUMENTATION_ROOT_URL="$withval" ;;
       *)   AC_MSG_ERROR([documentation root URL does not end with /]) ;;
-     esac],
-     DOCUMENTATION_ROOT_URL="https://gcc.gnu.org/onlinedocs/"
-)
+     esac],[
+     docroot_url_suffix=
+changequote(,)dnl
+     case "$gcc_version" in
+       *.[123456].0) docroot_url_suffix="gcc-$gcc_version/";;
+       *.[123456].1) docroot_url_suffix="gcc-`echo $gcc_version | sed 's/1$/0/'`/";;
+     esac
+changequote([,])dnl
+     DOCUMENTATION_ROOT_URL="https://gcc.gnu.org/onlinedocs/$docroot_url_suffix"
+])
 AC_DEFINE_UNQUOTED(DOCUMENTATION_ROOT_URL,"$DOCUMENTATION_ROOT_URL",
 	[Define to the root for documentation URLs.])
 
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index 1c58dc334ab..988c373aedc 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -764,7 +764,9 @@ The default value refers to the FSF's GCC bug tracker.
 Specify the URL root that contains GCC option documentation.  The @var{url}
 should end with a @code{/} character.
 
-The default value is @uref{https://gcc.gnu.org/onlinedocs/,,https://gcc.gnu.org/onlinedocs/}.
+The default value is @uref{https://gcc.gnu.org/onlinedocs/,,https://gcc.gnu.org/onlinedocs/}
+on the GCC main development trunk.  On release branches, the default
+is @code{https://gcc.gnu.org/onlinedocs/gcc-@var{major}.@var{minor}.0/}.
 
 @item --with-changes-root-url=@var{url}
 Specify the URL root that contains information about changes in GCC
diff --git a/gcc/gcc-urlifier.cc b/gcc/gcc-urlifier.cc
index ff8c3f65ac5..be6459e8d7c 100644
--- a/gcc/gcc-urlifier.cc
+++ b/gcc/gcc-urlifier.cc
@@ -26,7 +26,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "gcc-urlifier.h"
 #include "opts.h"
 #include "options.h"
-#include "diagnostic-core.h"
 #include "selftest.h"
 
 namespace {
@@ -209,16 +208,7 @@ gcc_urlifier::make_doc_url (const char *doc_url_suffix)
   if (!doc_url_suffix)
     return nullptr;
 
-  char infix[32];
-  /* On release branches, append to DOCUMENTATION_ROOT_URL the
-     subdirectory with documentation of the latest release made
-     from the branch.  */
-  if (BUILDING_GCC_MINOR != 0 && BUILDING_GCC_PATCHLEVEL <= 1U)
-    sprintf (infix, "gcc-%u.%u.0/",
-	     BUILDING_GCC_MAJOR, BUILDING_GCC_MINOR);
-  else
-    infix[0] = '\0';
-  return concat (DOCUMENTATION_ROOT_URL, infix, doc_url_suffix, nullptr);
+  return concat (DOCUMENTATION_ROOT_URL, doc_url_suffix, nullptr);
 }
 
 } // anonymous namespace
diff --git a/gcc/opts.cc b/gcc/opts.cc
index a90dc57f8b5..3333600e0ea 100644
--- a/gcc/opts.cc
+++ b/gcc/opts.cc
@@ -3761,19 +3761,7 @@ get_option_url (const diagnostic_context *,
     {
       label_text url_suffix = get_option_url_suffix (option_index, lang_mask);
       if (url_suffix.get ())
-	{
-	  char infix[32];
-	  /* On release branches, append to DOCUMENTATION_ROOT_URL the
-	     subdirectory with documentation of the latest release made
-	     from the branch.  */
-	  if (BUILDING_GCC_MINOR != 0 && BUILDING_GCC_PATCHLEVEL <= 1U)
-	    sprintf (infix, "gcc-%u.%u.0/",
-		     BUILDING_GCC_MAJOR, BUILDING_GCC_MINOR);
-	  else
-	    infix[0] = '\0';
-	  return concat (DOCUMENTATION_ROOT_URL, infix, url_suffix.get (),
-			 nullptr);
-	}
+	return concat (DOCUMENTATION_ROOT_URL, url_suffix.get (), nullptr);
     }
 
   return nullptr;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-04-24 16:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-24 16:31 [gcc r14-10109] v2: DOCUMENTATION_ROOT_URL vs. release branches [PR114738] Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).