From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Sparse Mailing-list <linux-sparse@vger.kernel.org>
Subject: Re: [PATCH 14/15] cleanup: move parsing helpers to parse.c
Date: Sun, 5 Jul 2020 22:45:00 +0200 [thread overview]
Message-ID: <20200705204500.sl7xgkukhsittq56@ltop.local> (raw)
In-Reply-To: <CAHk-=wh-Eb-LZawa7fH7BOmbq-t8t8GvaY7o9bEW9cGXZgKGsQ@mail.gmail.com>
On Sun, Jul 05, 2020 at 10:27:36AM -0700, Linus Torvalds wrote:
> On Sun, Jul 5, 2020 at 6:02 AM Luc Van Oostenryck
> <luc.vanoostenryck@gmail.com> wrote:
> >
> > lib.c contains 2-3 helpers for parsing. Move them to parse.c.
>
> This makes sense, because it's not a "library" function if it's only
> used in one place.
>
> HOWEVER.
>
> When doing things like this, please also mark the resulting function
> static and remove the declaration from lib.h.
>
> Otherwise it's entirely pointless, I feel.
>
> Either it's a library function that gets used from other places (and
> lib.c/lib.h is an appropriate place), or it's a parsing-only helper
> function that _doesn't_ get used from other places (and it should be
> moved to parse.c and be static).
>
> Not this half-way state that this patch seems to create.
Yes, I agree.
I see them as parsing-only helpers hence the move but (just)
expect() is also used in expression.c. I suppose it should be
fine to move the declaration to parse.h despite not being ideal.
Or maybe, I should just leave them in lib.c
-- Luc
next prev parent reply other threads:[~2020-07-05 20:45 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-05 13:02 [PATCH 00/15] tidy-up options / reorganize lib.c Luc Van Oostenryck
2020-07-05 13:02 ` [PATCH 01/15] options: let handle_onoff_switch() use null terminated arrays Luc Van Oostenryck
2020-07-05 13:02 ` [PATCH 02/15] options: move -Wsparse-all's processing out of handle_onoff_switch() Luc Van Oostenryck
2020-07-05 13:02 ` Luc Van Oostenryck
2020-07-05 13:02 ` [PATCH 03/15] options: move on top the definition of warning type enums Luc Van Oostenryck
2020-07-05 13:02 ` Luc Van Oostenryck
2020-07-05 13:02 ` [PATCH 04/15] options: make Wsparse_error less special Luc Van Oostenryck
2020-07-05 13:02 ` [PATCH 05/15] options: handle_onoff_switch() can handle any flags, not only warnings Luc Van Oostenryck
2020-07-05 13:02 ` [PATCH 06/15] options: move helpers up Luc Van Oostenryck
2020-07-05 13:02 ` Luc Van Oostenryck
2020-07-05 13:02 ` [PATCH 07/15] options: alphasort the handle_switch_[a-zA_Z]() Luc Van Oostenryck
2020-07-05 13:02 ` Luc Van Oostenryck
2020-07-05 13:02 ` [PATCH 08/15] options: avoid spaces between function name and arguments list Luc Van Oostenryck
2020-07-05 13:02 ` [PATCH 09/15] options: move declaration of tabstop out of "token.h" Luc Van Oostenryck
2020-07-05 13:02 ` [PATCH 10/15] options: add a small helper: handle_switch_finalize() Luc Van Oostenryck
2020-07-05 13:02 ` [PATCH 11/15] options: move option parsing in a separate file Luc Van Oostenryck
2020-07-05 13:02 ` [PATCH 12/15] options: keep the options sorted Luc Van Oostenryck
2020-07-05 13:02 ` Luc Van Oostenryck
2020-07-05 13:02 ` [PATCH 13/15] cleanup: move predefines in a separate file Luc Van Oostenryck
2020-07-05 13:02 ` [PATCH 14/15] cleanup: move parsing helpers to parse.c Luc Van Oostenryck
2020-07-05 17:27 ` Linus Torvalds
2020-07-05 20:45 ` Luc Van Oostenryck [this message]
2020-07-05 13:02 ` [PATCH 15/15] cleanup: move hexval() to utils.c Luc Van Oostenryck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200705204500.sl7xgkukhsittq56@ltop.local \
--to=luc.vanoostenryck@gmail.com \
--cc=linux-sparse@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).