bug-indent
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

wish: unbreakable "function" name


From: Basile Starynkevitch
Subject: wish: unbreakable "function" name
Date: Sun, 17 Apr 2016 17:52:03 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.7.0

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} ***




reply via email to

[Prev in Thread] Current Thread [Next in Thread]