Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
To: kumagai-atsushi@mxc.nes.nec.co.jp
Cc: kexec@lists.infradead.org, crash-utility@redhat.com
Subject: [PATCH makedumpfile v2 2/4] Avoid LONG_MAX/ULONG_MAX redefinitions
Date: Thu, 23 Feb 2012 10:34:05 +0900	[thread overview]
Message-ID: <20120223013405.5041.35977.stgit@localhost6.localdomain6> (raw)
In-Reply-To: <20120223012940.5041.61104.stgit@localhost6.localdomain6>

common.h locally defines LONG_MAX and ULONG_MAX. But when importing
lzo library's headers, ulimit.h that is imported implicitly is also
imported so the two definitions collide, and the warning message below
is displayed.

gcc -g -O2 -Wall -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -DVERSION='"1.4.2"' -DRELEASE_DATE='"25 January 2012"' -D__x86_64__ -DUSELZO  print_info.o dwarf_info.o elf_info.o erase_info.o sadump_info.o arch/arm.o arch/x86.o arch/x86_64.o arch/ia64.o arch/ppc64.o arch/s390x.o -o makedumpfile makedumpfile.c -llzo2 -ldw -lbz2 -lebl -ldl -lelf -lz
In file included from makedumpfile.h:37:0,
                 from makedumpfile.c:16:
common.h:23:0: warning: "LONG_MAX" redefined
/usr/lib/gcc/x86_64-redhat-linux/4.5.1/include/limits.h:132:0: note: this is the location of the previous definition
common.h:24:0: warning: "ULONG_MAX" redefined
/usr/lib/gcc/x86_64-redhat-linux/4.5.1/include/limits.h:136:0: note: this is the location of the previous definition

To avoid this problem, check if each has already defiend before
defining it.

Signed-off-by: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
---

 common.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/common.h b/common.h
index a4cc2f7..6ad3ca7 100644
--- a/common.h
+++ b/common.h
@@ -20,8 +20,12 @@
 #define FALSE		(0)
 #define ERROR		(-1)
 
+#ifndef LONG_MAX
 #define LONG_MAX	((long)(~0UL>>1))
+#endif
+#ifndef ULONG_MAX
 #define ULONG_MAX	(~0UL)
+#endif
 #define ULONGLONG_MAX	(~0ULL)
 
 #define MAX(a,b)	((a) > (b) ? (a) : (b))


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

  parent reply	other threads:[~2012-02-23  1:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-23  1:33 [PATCH makedumpfile v2 0/4] LZO Compression Support HATAYAMA Daisuke
2012-02-23  1:33 ` [PATCH makedumpfile v2 1/4] Add LZO Support HATAYAMA Daisuke
2012-02-23  1:34 ` HATAYAMA Daisuke [this message]
2012-02-23  1:34 ` [PATCH makedumpfile v2 3/4] Add help and manual messages about LZO compression support HATAYAMA Daisuke
2012-02-23  1:34 ` [PATCH makedumpfile v2 4/4] Add build condition for LZO support HATAYAMA Daisuke
2012-02-23  8:16 ` [PATCH makedumpfile v2 0/4] LZO Compression Support Atsushi Kumagai
2012-05-10  0:38   ` HATAYAMA Daisuke
2012-05-10  3:40     ` Atsushi Kumagai
2012-05-10  4:40       ` HATAYAMA Daisuke
2012-03-23  7:33 ` Atsushi Kumagai
2012-03-23  8:26   ` HATAYAMA Daisuke
2012-03-28  5:18     ` Atsushi Kumagai
2012-03-28  7:50       ` HATAYAMA Daisuke
2012-03-28  7:59         ` Bouchard Louis
2012-03-28  8:19           ` HATAYAMA Daisuke

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=20120223013405.5041.35977.stgit@localhost6.localdomain6 \
    --to=d.hatayama@jp.fujitsu.com \
    --cc=crash-utility@redhat.com \
    --cc=kexec@lists.infradead.org \
    --cc=kumagai-atsushi@mxc.nes.nec.co.jp \
    /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