DCCP protocol discussions
 help / color / mirror / Atom feed
From: Gerrit Renker <gerrit@erg.abdn.ac.uk>
To: dccp@vger.kernel.org
Subject: Re: [PATCH 17/25] Share ccid3_tx_state_name function via tfrc_ccids
Date: Sat, 10 Nov 2007 12:31:50 +0000	[thread overview]
Message-ID: <20071110123150.GA15462@gerrit.erg.abdn.ac.uk> (raw)
In-Reply-To: <200710312131.52573.leandroal@gmail.com>

| [CCID-3/4] Share ccid3_tx_state_name function via tfrc_ccids

There is a build problem in declaring the following routines as shared:

#if defined(CONFIG_IP_DCCP_CCID3_DEBUG) || defined(CONFIG_IP_DCCP_CCID4_DEBUG)
static const char *tfrc_tx_state_name(enum tfrc_hc_tx_states state)
{
	/* ... */
}
#endif

#if defined(CONFIG_IP_DCCP_CCID3_DEBUG) || defined(CONFIG_IP_DCCP_CCID4_DEBUG)
static const char *tfrc_rx_state_name(enum tfrc_hc_rx_states state)
{
	/* ... */
#endif

When enabling CCID3_DEBUG, but not CCID4_DEBUG, the following build warnings result:

/usr/src/davem-2.6/net/dccp/ccids/lib/tfrc_ccids.h:163: warning: 'tfrc_tx_state_name' defined but not used
/usr/src/davem-2.6/net/dccp/ccids/lib/tfrc_ccids.h:180: warning: 'tfrc_rx_state_name' defined but not used

The reason is that the header file is #included in ccid4.c and this function is only called from
within ccid4_pr_debug(). But when CCID4_DEBUG is disabled, this macro expands to an emptry string,
so the compiler thinks that tfrc_{rx,tx}_state_name() is not used -- which is actually the case.

So not very happy with the above solution. When getting serious about abstracting and sharing
common code, the best think is probably to use a single debugging function, tfrc_pr_debug.
This would be enabled when at least one of CCID3_DEBUG or CCID4_DEBUG is enabled, and one could
add some magic that the module parameters influence the boolean variable tfrc_debug.

The same could be done for the RTO timer - since the identical menu appears in both places.

Maybe it is better for the moment to `un-share' the code.

  parent reply	other threads:[~2007-11-10 12:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-01  0:31 [PATCH 17/25] Share ccid3_tx_state_name function via tfrc_ccids Leandro
2007-11-01 12:36 ` Tommi Saviranta
2007-11-10 12:31 ` Gerrit Renker [this message]
2007-11-13 16:14 ` Łeandro Sales

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=20071110123150.GA15462@gerrit.erg.abdn.ac.uk \
    --to=gerrit@erg.abdn.ac.uk \
    --cc=dccp@vger.kernel.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