The declaration of create_nested_ptr_option in the header has the 'from'
and 'to' parameters in the opposite order from the definition in
gengtype.c:

 /* Return an options structure for a "nested_ptr" option.  */
 options_p
 create_nested_ptr_option (options_p next, type_p t,
                           const char *to, const char *from)

and the only caller in gengtype-parse.c:

 return create_nested_ptr_option (prev, ty, to, from);

This patch swaps the parameter names in the declaration.

        PR c/79022
        * gengtype.h (create_nested_ptr_option): Fix parameter names to match
        definition.


I've rebuilt the compiler, but not run the tests, because this doesn't
change the meaning of any code and seems almost obvious.

OK for trunk?


commit 434ffd58b7ecb9e750d6cb2d955567ba1c0f4af2
Author: Jonathan Wakely <jwak...@redhat.com>
Date:   Thu Mar 28 13:07:30 2019 +0000

    PR c/79022 fix mismatch parameter order in declaratio
    
    The declaration of create_nested_ptr_option in the header has the 'from'
    and 'to' parameters in the opposite order from the definition in
    gengtype.c:
    
      /* Return an options structure for a "nested_ptr" option.  */
      options_p
      create_nested_ptr_option (options_p next, type_p t,
                                const char *to, const char *from)
    
    and the only caller in gengtype-parse.c:
    
      return create_nested_ptr_option (prev, ty, to, from);
    
    This patch swaps the parameter names in the declaration.
    
            PR c/79022
            * gengtype.h (create_nested_ptr_option): Fix parameter names to 
match
            definition.

diff --git a/gcc/gengtype.h b/gcc/gengtype.h
index db9cb0f401a..02be0c16b55 100644
--- a/gcc/gengtype.h
+++ b/gcc/gengtype.h
@@ -203,8 +203,8 @@ options_p create_nested_option (options_p next, const char* 
name,
                                struct nested_ptr_data* info);
 
 /* Create a nested pointer option.  */
-options_p create_nested_ptr_option (options_p, type_p t,
-                                    const char *from, const char *to);
+options_p create_nested_ptr_option (options_p next, type_p t,
+                                   const char *to, const char *from);
 
 /* A name and a type.  */
 struct pair {

Reply via email to