[SCM] Samba Shared Repository - branch master updated

Andrew Bartlett abartlet at samba.org
Tue Feb 18 15:19:04 MST 2014


The branch, master has been updated
       via  0d9bb86 build: find FILE_OFFSET_BITS via array
      from  cd65571 s3: printing: Fix problem with server taking too long to respond to a MSG_PRINTER_DRVUPGRADE message.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 0d9bb86293c9d39298786df095c73a6251b08b7e
Author: Gustavo Zacarias <gustavo at zacarias.com.ar>
Date:   Fri Jan 31 06:53:44 2014 -0300

    build: find FILE_OFFSET_BITS via array
    
    This makes cross-compiling happy, use a trick similar to autoconf's
    AC_CHECK_SIZEOF macro.
    Basically we make an array:
    
    static int array[1 - 2 * !(((long int)(sizeof(off_t))) < 8)];
    
    This gives -1 multiplied by the negation of the condition
    (sizeof(off_t) < 8) cast to a long int.
    So if the condition is true it gives array[(-1 * 0)] (remember the
    condition is cast and negated) thus passing a build test with a 0-sized
    array.
    If it's false it gives array[(-1 * 1)] thus failing with a
    negative-sized array.
    
    Signed-off-by: Gustavo Zacarias <gustavo at zacarias.com.ar>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    
    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date(master): Tue Feb 18 23:18:32 CET 2014 on sn-devel-104

-----------------------------------------------------------------------

Summary of changes:
 lib/ccan/wscript |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/ccan/wscript b/lib/ccan/wscript
index 59b8205..81039d0 100644
--- a/lib/ccan/wscript
+++ b/lib/ccan/wscript
@@ -127,15 +127,18 @@ def configure(conf):
     # Only check for FILE_OFFSET_BITS=64 if off_t is normally small:
     # use raw routines because wrappers include previous _GNU_SOURCE
     # or _FILE_OFFSET_BITS defines.
+    # The math for these tests is:
+    # array[-1 * !((int)(condition)) ] (condition is true) = array[0] = builds
+    # array[-1 * !((int)(condition)) ] (condition is false) = array[-1] = fails
     conf.check(fragment="""#include <sys/types.h>
-               int main(void) { return !(sizeof(off_t) < 8); }""",
-               execute=True, msg='Checking for small off_t',
+               int main(void) { static int test_array[1 - 2 * !(((long int)(sizeof(off_t))) < 8)]; }""",
+               msg='Checking for small off_t',
                define_name='SMALL_OFF_T')
     # Unreliable return value above, hence use define.
     if conf.CONFIG_SET('SMALL_OFF_T'):
         conf.check(fragment="""#include <sys/types.h>
-                   int main(void) { return !(sizeof(off_t) >= 8); }""",
-                   execute=True, msg='Checking for -D_FILE_OFFSET_BITS=64',
+		   int main(void) { static int test_array[1 - 2 * !(((long int)(sizeof(off_t))) >= 8)]; }""",
+                   msg='Checking for -D_FILE_OFFSET_BITS=64',
                    ccflags='-D_FILE_OFFSET_BITS=64',
                    define_name='HAVE_FILE_OFFSET_BITS')
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list