diff mbox

gengtype plugin improvement last4round -patch 4 [filerules]

Message ID AANLkTinJV-RrS55ZTpqHTRG=kmfpwak=qO6fivirKPbr@mail.gmail.com
State New
Headers show

Commit Message

H.J. Lu Nov. 22, 2010, 7:44 p.m. UTC
On Sun, Nov 21, 2010 at 11:39 PM, Basile Starynkevitch
<basile@starynkevitch.net> wrote:
> On Mon, 22 Nov 2010 08:53:54 +0200
> Laurynas Biveinis <laurynas.biveinis@gmail.com> wrote:
>> > Ok if it bootstraps?
>>
>> OK if it bootstraps and since this changes a potentially fragile area,
>> could you also check that before/after gengtype output is identical.
>
>
> It did bootstrap, and I
>
> Committed revision 167024.
>

This caused:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46609

I am testing the enclosed patch.  I will check it in if it passes bootstrap
with and without --enable-checking=assert

H.J.
---

Comments

Laurynas Biveinis Nov. 23, 2010, 3:48 a.m. UTC | #1
2010/11/22 H.J. Lu <hjl.tools@gmail.com>:
> Index: gengtype.c
> ===================================================================
> --- gengtype.c  (revision 167038)
> +++ gengtype.c  (working copy)
> @@ -1863,16 +1863,21 @@ struct file_rule_st files_rules[] = {
>    "gtype-desc.c" for common headers and corresponding output
>    files for language-specific header files.  */
>  static outf_p
> -header_dot_h_frul (input_file* inpf, char**poutname, char**pforname)
> +header_dot_h_frul (input_file* inpf, char**poutname,
> +                  char**pforname ATTRIBUTE_UNUSED)
>  {
>   const char *basename = 0;
>   int lang_index = 0;
> +#if ENABLE_CHECKING
>   const char *inpname = get_input_file_name (inpf);
>   DBGPRINTF ("inpf %p inpname %s outname %s forname %s",
>             (void*) inpf, inpname, *poutname, *pforname);
> +#endif

In general, there is no need to surround DBGPRINTF with ENABLE_CHECKING.

 DBGPRINTF ("inpf %p inpname %s outname %s forname %s",
            (void*) inpf, get_input_file_name (inpf), *poutname, *pforname);

>   basename = get_file_basename (inpf);
>   lang_index = get_prefix_langdir_index (basename);
> +#if ENABLE_CHECKING
>   DBGPRINTF ("basename %s lang_index %d", basename, lang_index);
> +#endif

ENABLE_CHECKING should be dropped.

>
>   if (lang_index >= 0)
>     {
> @@ -1907,11 +1912,13 @@ source_dot_c_frul (input_file* inpf, cha
>  {
>   char *newbasename = CONST_CAST (char*, get_file_basename (inpf));
>   char *newoutname = CONST_CAST (char*, get_file_gtfilename (inpf));
> +#if ENABLE_CHECKING
>   const char *inpname = get_input_file_name (inpf);
>   DBGPRINTF ("inpf %p inpname %s original outname %s forname %s",
>             (void*) inpf, inpname, *poutname, *pforname);
>   DBGPRINTF ("newoutname %s", newoutname);
>   DBGPRINTF ("newbasename %s", newbasename);
> +#endif

inpname should be inlined into DBGPRINTF and ENABLE_CHECKING dropped.

A patch to make these changes is pre-approved. Basile, can you take
care of this?

Thanks,
diff mbox

Patch

Index: gengtype.c
===================================================================
--- gengtype.c	(revision 167038)
+++ gengtype.c	(working copy)
@@ -1863,16 +1863,21 @@  struct file_rule_st files_rules[] = {
    "gtype-desc.c" for common headers and corresponding output
    files for language-specific header files.  */
 static outf_p
-header_dot_h_frul (input_file* inpf, char**poutname, char**pforname)
+header_dot_h_frul (input_file* inpf, char**poutname,
+		   char**pforname ATTRIBUTE_UNUSED)
 {
   const char *basename = 0;
   int lang_index = 0;
+#if ENABLE_CHECKING
   const char *inpname = get_input_file_name (inpf);
   DBGPRINTF ("inpf %p inpname %s outname %s forname %s",
 	     (void*) inpf, inpname, *poutname, *pforname);
+#endif
   basename = get_file_basename (inpf);
   lang_index = get_prefix_langdir_index (basename);
+#if ENABLE_CHECKING
   DBGPRINTF ("basename %s lang_index %d", basename, lang_index);
+#endif

   if (lang_index >= 0)
     {
@@ -1907,11 +1912,13 @@  source_dot_c_frul (input_file* inpf, cha
 {
   char *newbasename = CONST_CAST (char*, get_file_basename (inpf));
   char *newoutname = CONST_CAST (char*, get_file_gtfilename (inpf));
+#if ENABLE_CHECKING
   const char *inpname = get_input_file_name (inpf);
   DBGPRINTF ("inpf %p inpname %s original outname %s forname %s",
 	     (void*) inpf, inpname, *poutname, *pforname);
   DBGPRINTF ("newoutname %s", newoutname);
   DBGPRINTF ("newbasename %s", newbasename);
+#endif
   free (*poutname);
   free (*pforname);
   *poutname = newoutname;