This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[C++ Patch] Fix some locations


Hi,

while working on some bugs I noticed that in a few places in decl.c we could do better in terms of locations within the current infrastructure, some simple, straightforward improvements. I'm attaching below a tiny first patch, more to follow, I hope.

For example, a function which could be improved in many places is grok_ctor_properties and, before going ahead, I'd like to ask about something I noticed yesterday:

  /* There can be no default arguments.  */
  for (tree arg = argtypes; arg != void_list_node; arg = TREE_CHAIN (arg))
    if (TREE_PURPOSE (arg))
      {
        TREE_PURPOSE (arg) = NULL_TREE;
        if (operator_code == POSTINCREMENT_EXPR
            || operator_code == POSTDECREMENT_EXPR)
          pedwarn (input_location, OPT_Wpedantic,
                   "%qD cannot have default arguments", decl);
        else
          {
            error ("%qD cannot have default arguments", decl);
            return false;
          }
      }

the special casing seems weird, so far I haven't been able to find anything in the standard about it and all the other compilers I have at hand (Oracle, Intel, Clang) don't seem to have it. Shall we keep it or not? Maybe with an additional comment explaining the rationale? The affected testcases would be parse/defarg11.C and g++.jason/operator.C.

Thanks, Paolo.

///////////////////

Attachment: CL_locs_3
Description: Text document

Attachment: patch_locs_3
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]