From: Sam Ravnborg <sam@ravnborg.org>
To: Timur Tabi <timur@tabi.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: mconf.c and bindtextdomain() -- warnings while cross-compiling on OS X
Date: Sun, 4 May 2008 09:33:13 +0200 [thread overview]
Message-ID: <20080504073313.GA16259@uranus.ravnborg.org> (raw)
In-Reply-To: <481D344C.9080904@tabi.org>
On Sat, May 03, 2008 at 10:58:04PM -0500, Timur Tabi wrote:
> I'm cross-compiling the kernel on an OS X system, and when I run "make
> menuconfig", I get this warning:
>
> HOSTCC scripts/kconfig/mconf.o
> scripts/kconfig/mconf.c: In function ‘main’:
> scripts/kconfig/mconf.c:871: warning: statement with no effect
> scripts/kconfig/mconf.c:872: warning: statement with no effect
>
> Here is the code in question:
>
> int main(int ac, char **av)
> {
> int saved_x, saved_y;
> char *mode;
> int res;
>
> setlocale(LC_ALL, "");
> bindtextdomain(PACKAGE, LOCALEDIR); <--- line 871
> textdomain(PACKAGE);
>
> I believe the warnings are from this code in lkc.h:
>
> #ifndef KBUILD_NO_NLS
> # include <libintl.h>
> #else
> # define gettext(Msgid) ((const char *) (Msgid))
> # define textdomain(Domainname) ((const char *) (Domainname))
> # define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname))
> #endif
>
> Can someone explain to me why this macros are defined in this way? Every
> place where textdomain() and bindtext() are used, they are used like this:
>
> bindtextdomain(PACKAGE, LOCALEDIR);
> textdomain(PACKAGE);
>
> In other words, the return value from these macros is never used, so the
> warning is inevitable.
>
> I think the code in lkc.h should be changed to:
>
> # define textdomain(Domainname) do {} while(0)
> # define bindtextdomain(Domainname, Dirname) do {} while(0)
>
> I can't say for certain whether this is a good idea, though, because I'm
> not at all familiar with this code.
I have queued up following patch. It is obviously correct and builds without
warnings here. Can you give it a try on your box.
Sam
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
index 4bc68f2..1a728fc 100644
--- a/scripts/kconfig/lkc.h
+++ b/scripts/kconfig/lkc.h
@@ -11,9 +11,9 @@
#ifndef KBUILD_NO_NLS
# include <libintl.h>
#else
-# define gettext(Msgid) ((const char *) (Msgid))
-# define textdomain(Domainname) ((const char *) (Domainname))
-# define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname))
+static inline void const char *gettext(const char *txt) { return txt; }
+static inline void textdomain(const char *domainname) {}
+static inline void bindtextdomain(const char *name, const char *dir) {}
#endif
#ifdef __cplusplus
next prev parent reply other threads:[~2008-05-04 7:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-04 3:58 Timur Tabi
2008-05-04 7:33 ` Sam Ravnborg [this message]
2008-05-04 18:42 ` Timur Tabi
2008-05-04 19:08 ` Sam Ravnborg
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=20080504073313.GA16259@uranus.ravnborg.org \
--to=sam@ravnborg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=timur@tabi.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
Powered by JetHome