1
1

Label what the GAP_TEST macro does. Print more meaningful output as

to what the test is doing (i.e., checking for gaps between struct fields).

This commit was SVN r30070.
Этот коммит содержится в:
Jeff Squyres 2013-12-24 11:03:24 +00:00
родитель 38f46641ce
Коммит bceaa347b1

Просмотреть файл

@ -1,6 +1,6 @@
/* /*
* Copyright (c) 2009 Sun Microsystems, Inc All rights reserved. * Copyright (c) 2009 Sun Microsystems, Inc All rights reserved.
* Copyright (c) 2009 Cisco Systems, Inc All rights reserved. * Copyright (c) 2009-2013 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2013 The University of Tennessee and The University * Copyright (c) 2013 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights * of Tennessee Research Foundation. All rights
* reserved. * reserved.
@ -23,11 +23,17 @@
#include <stdlib.h> #include <stdlib.h>
#define GAP_CHECK(NAME, BASE, F1, F2, CGAP) { \ /*
* See if there is a gap between two fields in a given struct
*/
#define GAP_CHECK(NAME, BASE, F1, F2, CGAP) \
{ \
offset = (size_t)&BASE.F1 - (size_t)&BASE; \ offset = (size_t)&BASE.F1 - (size_t)&BASE; \
exp_offset = ((size_t)&BASE.F2 - (size_t)&BASE) + sizeof(BASE.F2); \ exp_offset = ((size_t)&BASE.F2 - (size_t)&BASE) + sizeof(BASE.F2); \
printf(NAME" = %lu, %lu ", offset, sizeof(BASE.F1)); \ printf(NAME " offset from base = %lu, sizeof %lu ", offset, sizeof(BASE.F1)); \
if (CGAP && offset != exp_offset) printf("***"); \ if (CGAP && offset != exp_offset) { \
printf("(*** gap between " #F1 " and " #F2 " ***)"); \
} \
printf("\n"); \ printf("\n"); \
} }