wish: unbreakable "function" name

Basile Starynkevitch <[email protected]> Sun, 17 Apr 2016 17:52:03 +0200
Newsgroups gmane.comp.gnu.indent.bugs
Message-ID <[email protected]>
Hello All,

I would be very happy if GNU indent had the following feature: a program 
option --unbreakable-function <NAME> (I don't care about that particular 
option name, but I care a lot about the functionality) whiwh would 
prohibit that name to be followed by an indent-inserted newline.

In other words, assuming I run
    indent --unbreakable-function BAR foo.c
and if my foo.c had code like
     if (something_very_long_here && BAR(x) != NULL)
I want indent to be prohibited to indent it as
    if (something_very_long_here && BAR
                                                        (x) != NULL)
but instead I want indent to be forced to put the newline before BAR or 
after the closing parenthesis, e.g.
    if (something_very_long_here
        && BAR(x) != NULL)
or
   if (something_very_long_hjere && BAR(x)
                                                        != NULL)

A concrete use case: I am an occasional contributor to GCC, and the main 
author of its experimental MELT branch and plugin. See 
http://gcc-melt.org/ for more.

My code contains:

     #define MELT_PREDEF(Glob) melt_fetch_predefined(MELTGLOB_##Glob)

and many occurrences of that macro, e.g. MELT_PREDEF (DISCR_ANY_RECEIVER)
and I really don't want that to be broken (in particular, because I 
would often grep for that thing).


To be specific, the only "pattern" which I don't want to be 
newline-broken is a specific name -here MELT_PREDEF, or the BAR above- 
followed by optional spaces followed by an opening parenthesis

Perhaps this is a feature already available in recent GNU indent, but I 
did not found it....

Thanks for reading.

Regards.


PS. Sadly, my copyright assignment covers only GCC (not anything else), 
so I won't even try to propose any patch to GNU indent (and it is too 
painful for me to have the copyright assignment improved).

-- 
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mine, sont seulement les miennes} ***