--with-{documentation,changes}-root-url tweaks
authorJakub Jelinek <jakub@redhat.com>
Thu, 30 Apr 2020 09:49:40 +0000 (11:49 +0200)
committerJakub Jelinek <jakub@redhat.com>
Thu, 30 Apr 2020 09:49:40 +0000 (11:49 +0200)
>   , CHANGES_URL ("gcc-10/changes.html#empty_base");
>
> where the macro would just use preprocessor string concatenation?

Ok, the following patch implements it (doesn't introduce a separate
macro and just uses CHANGES_ROOT_URL "gcc-10/changes.html#empty_base"),
in addition adds the documentation Joseph requested.

2020-04-30  Jakub Jelinek  <jakub@redhat.com>

* configure.ac (--with-documentation-root-url,
--with-changes-root-url): Diagnose URL not ending with /,
use AC_DEFINE_UNQUOTED instead of AC_SUBST.
* opts.h (get_changes_url): Remove.
* opts.c (get_changes_url): Remove.
* Makefile.in (CFLAGS-opts.o): Don't add -DDOCUMENTATION_ROOT_URL
or -DCHANGES_ROOT_URL.
* doc/install.texi (--with-documentation-root-url,
--with-changes-root-url): Document.
* config/arm/arm.c (aapcs_vfp_is_call_or_return_candidate): Don't call
get_changes_url and free, change url variable type to const char * and
set it to CHANGES_ROOT_URL "gcc-10/changes.html#empty_base".
* config/s390/s390.c (s390_function_arg_vector,
s390_function_arg_float): Likewise.
* config/aarch64/aarch64.c (aarch64_vfp_is_call_or_return_candidate):
Likewise.
* config/rs6000/rs6000-call.c (rs6000_discover_homogeneous_aggregate):
Likewise.
* config.in: Regenerate.
* configure: Regenerate.

12 files changed:
gcc/ChangeLog
gcc/Makefile.in
gcc/config.in
gcc/config/aarch64/aarch64.c
gcc/config/arm/arm.c
gcc/config/rs6000/rs6000-call.c
gcc/config/s390/s390.c
gcc/configure
gcc/configure.ac
gcc/doc/install.texi
gcc/opts.c
gcc/opts.h

index 3769a91999f90ad722f23aad35b2380f0aab467a..5b69334a26b882c0b57cf3f5e777ece5fd11259a 100644 (file)
@@ -1,3 +1,26 @@
+2020-04-30  Jakub Jelinek  <jakub@redhat.com>
+
+       * configure.ac (--with-documentation-root-url,
+       --with-changes-root-url): Diagnose URL not ending with /,
+       use AC_DEFINE_UNQUOTED instead of AC_SUBST.
+       * opts.h (get_changes_url): Remove.
+       * opts.c (get_changes_url): Remove.
+       * Makefile.in (CFLAGS-opts.o): Don't add -DDOCUMENTATION_ROOT_URL
+       or -DCHANGES_ROOT_URL.
+       * doc/install.texi (--with-documentation-root-url,
+       --with-changes-root-url): Document.
+       * config/arm/arm.c (aapcs_vfp_is_call_or_return_candidate): Don't call
+       get_changes_url and free, change url variable type to const char * and
+       set it to CHANGES_ROOT_URL "gcc-10/changes.html#empty_base".
+       * config/s390/s390.c (s390_function_arg_vector,
+       s390_function_arg_float): Likewise.
+       * config/aarch64/aarch64.c (aarch64_vfp_is_call_or_return_candidate):
+       Likewise.
+       * config/rs6000/rs6000-call.c (rs6000_discover_homogeneous_aggregate):
+       Likewise.
+       * config.in: Regenerate.
+       * configure: Regenerate.
+
 2020-04-30  Christophe Lyon  <christophe.lyon@linaro.org>
 
        PR target/57002
index 85f30bf03912941c2cbca5f4ef8f2cbbc7944ba9..543b477ff18ba3e34ac130114d8d60b75813ba58 100644 (file)
@@ -2186,9 +2186,6 @@ lto-wrapper$(exeext): $(LTO_WRAPPER_OBJS) libcommon-target.a $(LIBDEPS)
           $(LTO_WRAPPER_OBJS) libcommon-target.a $(LIBS)
        mv -f T$@ $@
 
-CFLAGS-opts.o += -DDOCUMENTATION_ROOT_URL=\"@DOCUMENTATION_ROOT_URL@\"
-CFLAGS-opts.o += -DCHANGES_ROOT_URL=\"@CHANGES_ROOT_URL@\"
-
 # Files used by all variants of C or by the stand-alone pre-processor.
 
 CFLAGS-c-family/c-opts.o += @TARGET_SYSTEM_ROOT_DEFINE@
index 01fb18dbbb5a34ca3433b820d4bd558ff1a6e64a..809e7b268237c448fd0e927bffad528c07cd593a 100644 (file)
 #endif
 
 
+/* Define to the root for URLs about GCC changes. */
+#ifndef USED_FOR_TARGET
+#undef CHANGES_ROOT_URL
+#endif
+
+
 /* Define as the number of bits in a byte, if `limits.h' doesn't. */
 #ifndef USED_FOR_TARGET
 #undef CHAR_BIT
 #endif
 
 
+/* Define to the root for documentation URLs. */
+#ifndef USED_FOR_TARGET
+#undef DOCUMENTATION_ROOT_URL
+#endif
+
+
 /* Define 0/1 if static analyzer feature is enabled. */
 #ifndef USED_FOR_TARGET
 #undef ENABLE_ANALYZER
index c1a050fbf2a03f0a4ed3d6fc4506024beca8c3fd..409ca8d9519921dc4997ee01a4e1157a9d442e41 100644 (file)
@@ -16883,7 +16883,8 @@ aarch64_vfp_is_call_or_return_candidate (machine_mode mode,
              && ((alt = aapcs_vfp_sub_candidate (type, &new_mode, NULL))
                  != ag_count))
            {
-             char *url = get_changes_url ("gcc-10/changes.html#empty_base");
+             const char *url
+               = CHANGES_ROOT_URL "gcc-10/changes.html#empty_base";
              gcc_assert (alt == -1);
              last_reported_type_uid = uid;
              /* Use TYPE_MAIN_VARIANT to strip any redundant const
@@ -16898,7 +16899,6 @@ aarch64_vfp_is_call_or_return_candidate (machine_mode mode,
                        "type %qT when C++17 is enabled changed to match "
                        "C++14 %{in GCC 10.1%}",
                        TYPE_MAIN_VARIANT (type), url);
-             free (url);
            }
 
          if (is_ha != NULL) *is_ha = true;
index 29f2a0c296708032a39806e968b63b7ae6a89921..b169250918c13c6eabf55146a79081514d171571 100644 (file)
@@ -6414,7 +6414,8 @@ aapcs_vfp_is_call_or_return_candidate (enum arm_pcs pcs_variant,
              && ((alt = aapcs_vfp_sub_candidate (type, &new_mode, NULL))
                  != ag_count))
            {
-             char *url = get_changes_url ("gcc-10/changes.html#empty_base");
+             const char *url
+               = CHANGES_ROOT_URL "gcc-10/changes.html#empty_base";
              gcc_assert (alt == -1);
              last_reported_type_uid = uid;
              /* Use TYPE_MAIN_VARIANT to strip any redundant const
@@ -6429,7 +6430,6 @@ aapcs_vfp_is_call_or_return_candidate (enum arm_pcs pcs_variant,
                        "type %qT when C++17 is enabled changed to match "
                        "C++14 %{in GCC 10.1%}",
                        TYPE_MAIN_VARIANT (type), url);
-             free (url);
            }
          *count = ag_count;
        }
index 4e6dd34f446ee6e51f25397d49e65849ca2ef7c0..7621d6f5278713b2e1eaf061bac90424021b5a8b 100644 (file)
@@ -5748,8 +5748,8 @@ rs6000_discover_homogeneous_aggregate (machine_mode mode, const_tree type,
                  unsigned uid = TYPE_UID (TYPE_MAIN_VARIANT (type));
                  if (uid != last_reported_type_uid)
                    {
-                     char *url
-                       = get_changes_url ("gcc-10/changes.html#empty_base");
+                     const char *url
+                       = CHANGES_ROOT_URL "gcc-10/changes.html#empty_base";
                      if (empty_base_seen & 1)
                        inform (input_location,
                                "parameter passing for argument of type %qT "
@@ -5761,7 +5761,6 @@ rs6000_discover_homogeneous_aggregate (machine_mode mode, const_tree type,
                                "with %<[[no_unique_address]]%> members "
                                "changed %{in GCC 10.1%}", type, url);
                      last_reported_type_uid = uid;
-                     free (url);
                    }
                }
              return true;
index 40281e87254e2fbfc1e45e68de4b9e4d2177f10f..18332271ed7124d9145c967a09f8299ea95fc779 100644 (file)
@@ -11960,7 +11960,7 @@ s390_function_arg_vector (machine_mode mode, const_tree type)
       unsigned uid = TYPE_UID (TYPE_MAIN_VARIANT (orig_type));
       if (uid != last_reported_type_uid)
        {
-         char *url = get_changes_url ("gcc-10/changes.html#empty_base");
+         const char *url = CHANGES_ROOT_URL "gcc-10/changes.html#empty_base";
          last_reported_type_uid = uid;
          if (empty_base_seen & 1)
            inform (input_location,
@@ -11972,7 +11972,6 @@ s390_function_arg_vector (machine_mode mode, const_tree type)
                    "parameter passing for argument of type %qT with "
                    "%<[[no_unique_address]]%> members changed "
                    "%{in GCC 10.1%}", orig_type, url);
-         free (url);
        }
     }
   return true;
@@ -12038,7 +12037,7 @@ s390_function_arg_float (machine_mode mode, const_tree type)
       unsigned uid = TYPE_UID (TYPE_MAIN_VARIANT (orig_type));
       if (uid != last_reported_type_uid)
        {
-         char *url = get_changes_url ("gcc-10/changes.html#empty_base");
+         const char *url = CHANGES_ROOT_URL "gcc-10/changes.html#empty_base";
          last_reported_type_uid = uid;
          if (empty_base_seen & 1)
            inform (input_location,
@@ -12050,7 +12049,6 @@ s390_function_arg_float (machine_mode mode, const_tree type)
                    "parameter passing for argument of type %qT with "
                    "%<[[no_unique_address]]%> members changed "
                    "%{in GCC 10.1%}", orig_type, url);
-         free (url);
        }
     }
 
index c8fb7a8a7ac4af45b740a850812f073378b1181e..f7030a2356fb93c0ff6d2858e5c6e747ef0a0269 100755 (executable)
@@ -819,8 +819,6 @@ accel_dir_suffix
 real_target_noncanonical
 enable_as_accelerator
 gnat_install_lib
-CHANGES_ROOT_URL
-DOCUMENTATION_ROOT_URL
 REPORT_BUGS_TEXI
 REPORT_BUGS_TO
 PKGVERSION
@@ -7851,8 +7849,8 @@ if test "${with_documentation_root_url+set}" = set; then :
   withval=$with_documentation_root_url; case "$withval" in
       yes) as_fn_error $? "documentation root URL not specified" "$LINENO" 5 ;;
       no)  as_fn_error $? "documentation root URL not specified" "$LINENO" 5 ;;
-      *)   DOCUMENTATION_ROOT_URL="$withval"
-          ;;
+      */)  DOCUMENTATION_ROOT_URL="$withval" ;;
+      *)   as_fn_error $? "documentation root URL does not end with /" "$LINENO" 5 ;;
      esac
 else
   DOCUMENTATION_ROOT_URL="https://gcc.gnu.org/onlinedocs/"
@@ -7860,6 +7858,10 @@ else
 fi
 
 
+cat >>confdefs.h <<_ACEOF
+#define DOCUMENTATION_ROOT_URL "$DOCUMENTATION_ROOT_URL"
+_ACEOF
+
 
 # Allow overriding the default URL for GCC changes
 
@@ -7868,8 +7870,8 @@ if test "${with_changes_root_url+set}" = set; then :
   withval=$with_changes_root_url; case "$withval" in
       yes) as_fn_error $? "changes root URL not specified" "$LINENO" 5 ;;
       no)  as_fn_error $? "changes root URL not specified" "$LINENO" 5 ;;
-      *)   CHANGES_ROOT_URL="$withval"
-          ;;
+      */)  CHANGES_ROOT_URL="$withval" ;;
+      *)   as_fn_error $? "changes root URL does not end with /" "$LINENO" 5 ;;
      esac
 else
   CHANGES_ROOT_URL="https://gcc.gnu.org/"
@@ -7877,6 +7879,10 @@ else
 fi
 
 
+cat >>confdefs.h <<_ACEOF
+#define CHANGES_ROOT_URL "$CHANGES_ROOT_URL"
+_ACEOF
+
 
 # Sanity check enable_languages in case someone does not run the toplevel
 # configure # script.
@@ -19009,7 +19015,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 19012 "configure"
+#line 19018 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -19115,7 +19121,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 19118 "configure"
+#line 19124 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
index 330e3285dce49e73228a04624deff2415a8fb124..12297b7369ed93f1886f22af70efc26159c56d84 100644 (file)
@@ -979,12 +979,13 @@ AC_ARG_WITH(documentation-root-url,
     [case "$withval" in
       yes) AC_MSG_ERROR([documentation root URL not specified]) ;;
       no)  AC_MSG_ERROR([documentation root URL not specified]) ;;
-      *)   DOCUMENTATION_ROOT_URL="$withval"
-          ;;
+      */)  DOCUMENTATION_ROOT_URL="$withval" ;;
+      *)   AC_MSG_ERROR([documentation root URL does not end with /]) ;;
      esac],
      DOCUMENTATION_ROOT_URL="https://gcc.gnu.org/onlinedocs/"
 )
-AC_SUBST(DOCUMENTATION_ROOT_URL)
+AC_DEFINE_UNQUOTED(DOCUMENTATION_ROOT_URL,"$DOCUMENTATION_ROOT_URL",
+       [Define to the root for documentation URLs.])
 
 # Allow overriding the default URL for GCC changes
 AC_ARG_WITH(changes-root-url,
@@ -993,12 +994,13 @@ AC_ARG_WITH(changes-root-url,
     [case "$withval" in
       yes) AC_MSG_ERROR([changes root URL not specified]) ;;
       no)  AC_MSG_ERROR([changes root URL not specified]) ;;
-      *)   CHANGES_ROOT_URL="$withval"
-          ;;
+      */)  CHANGES_ROOT_URL="$withval" ;;
+      *)   AC_MSG_ERROR([changes root URL does not end with /]) ;;
      esac],
      CHANGES_ROOT_URL="https://gcc.gnu.org/"
 )
-AC_SUBST(CHANGES_ROOT_URL)
+AC_DEFINE_UNQUOTED(CHANGES_ROOT_URL,"$CHANGES_ROOT_URL",
+       [Define to the root for URLs about GCC changes.])
 
 # Sanity check enable_languages in case someone does not run the toplevel
 # configure # script.
index 39ae0680260dabac0470dc9ce12e6b99625801c1..3c25a22cbb7b84649c44c9effaa0bf0a01d55eff 100644 (file)
@@ -684,6 +684,19 @@ if you determine that they are not bugs in your modifications.
 
 The default value refers to the FSF's GCC bug tracker.
 
+@item --with-documentation-root-url=@var{url}
+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/}.
+
+@item --with-changes-root-url=@var{url}
+Specify the URL root that contains information about changes in GCC
+releases like @code{gcc-@var{version}/changes.html}.
+The @var{url} should end with a @code{/} character.
+
+The default value is @uref{https://gcc.gnu.org/,,https://gcc.gnu.org/}.
+
 @end table
 
 @heading Target specification
index 12c0098f6b8e023753b0178f868150682ef3d0f7..c212a1a57dcfbdfb9cb419bfeaeb17aa9f23fdb0 100644 (file)
@@ -3190,16 +3190,6 @@ get_option_url (diagnostic_context *, int option_index)
     return NULL;
 }
 
-/* Given "gcc-10/changes.html#foobar", return that URL under
-   CHANGES_ROOT_URL (see --with-changes-root-url).
-   The caller is responsible for freeing the returned string.  */
-
-char *
-get_changes_url (const char *str)
-{
-  return concat (CHANGES_ROOT_URL, str, NULL);
-}
-
 #if CHECKING_P
 
 namespace selftest {
index b9c535049d24dc1baf60d9670dccfe85d2004adc..8f594b46e330b9ac5497035b93f19a39e2d4928c 100644 (file)
@@ -464,7 +464,6 @@ extern void parse_options_from_collect_gcc_options (const char *, obstack *,
                                                    int *);
 
 extern void prepend_xassembler_to_collect_as_options (const char *, obstack *);
-extern char *get_changes_url (const char *);
 
 /* Set OPTION in OPTS to VALUE if the option is not set in OPTS_SET.  */