public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: util-linux@vger.kernel.org
Subject: [PATCH] setterm: fix term.h/ncurses.h include ordering
Date: Sun, 29 Sep 2013 00:44:36 -0400	[thread overview]
Message-ID: <1380429876-25146-1-git-send-email-vapier@gentoo.org> (raw)

The ncurses term.h header has logic in it to detect if nucrses.h has
already been included and void defining things when it has.  But since
setterm includes term.h and the ncurses.h, it doesn't work and we can
get fun build-time warnings like:

  CC       term-utils/setterm-setterm.o
In file included from term-utils/setterm.c:109:0:
/usr/include/ncursesw/ncurses.h:827:12: warning: redundant redeclaration of 'tigetflag' [-Wredundant-decls]
 extern NCURSES_EXPORT(int) tigetflag (NCURSES_CONST char *);  /* implemented */
            ^
In file included from term-utils/setterm.c:106:0:
/usr/include/ncursesw/term.h:775:12: note: previous declaration of 'tigetflag' was here
 extern NCURSES_EXPORT(int) tigetflag (NCURSES_CONST char *);
            ^

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 term-utils/setterm.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/term-utils/setterm.c b/term-utils/setterm.c
index 310c3fa..d41e335 100644
--- a/term-utils/setterm.c
+++ b/term-utils/setterm.c
@@ -100,16 +100,17 @@
 #include <termios.h>
 #include <string.h>
 #include <fcntl.h>
+
 #ifndef NCURSES_CONST
 #define NCURSES_CONST const	/* define before including term.h */
 #endif
-#include <term.h>
-
 #ifdef HAVE_NCURSES_H
 #include <ncurses.h>
 #elif defined(HAVE_NCURSES_NCURSES_H)
 #include <ncurses/ncurses.h>
 #endif
+/* must include after ncurses.h */
+#include <term.h>
 
 #include <sys/param.h>		/* for MAXPATHLEN */
 #include <sys/ioctl.h>
-- 
1.8.3.2


                 reply	other threads:[~2013-09-29  4:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1380429876-25146-1-git-send-email-vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --cc=util-linux@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