All of lore.kernel.org
 help / color / mirror / Atom feed
From: Detlef Vollmann <dv@vollmann.ch>
To: xfs@oss.sgi.com
Subject: xfsdump doesn't compile: undefined reference to 'min'
Date: Thu, 06 Aug 2015 09:54:55 +0200	[thread overview]
Message-ID: <55C312CF.2040408@vollmann.ch> (raw)

[-- Attachment #1: Type: text/plain, Size: 565 bytes --]

 > commit 5a2985233c390d59d2a9757b119cb0e001c87a96
 > Author: Dave Chinner <dchinner@redhat.com>
 > Date:   Fri Jul 18 08:02:26 2014 +1000
 >
 >     dump: don't redefine min() or max()
 >
 >     They are included from other header files.
The message doesn't say from which header and configure doesn't test
for it.
If I compile it (cross-compilation, gcc, uclibc, xfsprogs 3.1.11,
xfsdump 3.1.4), I get lots of errors:
warning: implicit declaration of function 'max'
undefined reference to 'min'

Attached is a pragmatic patch.

   Detlef

PS: I'm not on the list.

[-- Attachment #2: 001-minmax.patch --]
[-- Type: text/x-patch, Size: 1624 bytes --]

diff --git a/common/util.h b/common/util.h
index 86ea8d2..460aea5 100644
--- a/common/util.h
+++ b/common/util.h
@@ -66,6 +66,12 @@ extern intgen_t read_buf( char *bufp,
 			  rrbfp_t return_read_buf_funcp,
 			  intgen_t *statp );
 
+#ifndef min
+#define min( a, b )	( ( ( a ) < ( b ) ) ? ( a ) : ( b ) )
+#endif
+#ifndef max
+#define max( a, b )	( ( ( a ) > ( b ) ) ? ( a ) : ( b ) )
+#endif
 
 
 /* strncpyterm - like strncpy, but guarantees the destination is null-terminated
diff --git a/restore/dirattr.c b/restore/dirattr.c
index fcfa0c8..6413c15 100644
--- a/restore/dirattr.c
+++ b/restore/dirattr.c
@@ -51,6 +51,10 @@
 
 /* structure definitions used locally ****************************************/
 
+#ifndef max
+#define max( a, b )	( ( ( a ) > ( b ) ) ? ( a ) : ( b ) )
+#endif
+
 /* node handle limits
  */
 #ifdef DIRATTRCHK
diff --git a/restore/namreg.c b/restore/namreg.c
index 41362d1..4630605 100644
--- a/restore/namreg.c
+++ b/restore/namreg.c
@@ -34,6 +34,10 @@
 
 /* structure definitions used locally ****************************************/
 
+#ifndef max
+#define max( a, b )	( ( ( a ) > ( b ) ) ? ( a ) : ( b ) )
+#endif
+
 #define NAMREG_AVGLEN	10
 
 /* persistent context for a namreg - placed in first page
diff --git a/restore/node.c b/restore/node.c
index 4cc8fb0..97d46e1 100644
--- a/restore/node.c
+++ b/restore/node.c
@@ -30,6 +30,13 @@
 #include "node.h"
 #include "mmap.h"
 
+#ifndef max
+#define max( a, b )	( ( ( a ) > ( b ) ) ? ( a ) : ( b ) )
+#endif
+#ifndef min
+#define min( a, b )	( ( ( a ) < ( b ) ) ? ( a ) : ( b ) )
+#endif
+
 extern size_t pgsz;
 extern size_t pgmask;
 

[-- Attachment #3: Type: text/plain, Size: 121 bytes --]

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

             reply	other threads:[~2015-08-06  7:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-06  7:54 Detlef Vollmann [this message]
2015-08-06 21:26 ` xfsdump doesn't compile: undefined reference to 'min' Dave Chinner
2015-08-07 12:16   ` Detlef Vollmann

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=55C312CF.2040408@vollmann.ch \
    --to=dv@vollmann.ch \
    --cc=xfs@oss.sgi.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.