Added support for three levels of nesting of the 'pragma pack'

directives.
This commit is contained in:
Francois Gouget 2000-10-19 20:20:07 +00:00 committed by Alexandre Julliard
parent 7c4bee569c
commit 23a5b79f56
5 changed files with 167 additions and 54 deletions

View File

@ -1,15 +1,63 @@
#ifdef __WINE_PSHPACK_H
#if defined(__WINE_PSHPACK_H3)
# ifndef __WINE_INTERNAL_POPPACK
# undef __WINE_PSHPACK_H3
# endif
/* Depth == 3 */
# if defined(__GNUC__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
# if __WINE_PSHPACK_H2 == 1
# pragma pack(1)
# elif __WINE_PSHPACK_H2 == 2
# pragma pack(2)
# elif __WINE_PSHPACK_H2 == 8
# pragma pack(8)
# else
# pragma pack(4)
# endif
# elif !defined(RC_INVOKED)
# error "Adjusting the alignment is not supported with this compiler"
# endif
#elif defined(__WINE_PSHPACK_H2)
# ifndef __WINE_INTERNAL_POPPACK
# undef __WINE_PSHPACK_H2
# endif
/* Depth == 2 */
# if defined(__GNUC__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
# if __WINE_PSHPACK_H == 1
# pragma pack(1)
# elif __WINE_PSHPACK_H == 2
# pragma pack(2)
# elif __WINE_PSHPACK_H == 8
# pragma pack(8)
# else
# pragma pack(4)
# endif
# elif !defined(RC_INVOKED)
# error "Adjusting the alignment is not supported with this compiler"
# endif
#elif defined(__WINE_PSHPACK_H)
# ifndef __WINE_INTERNAL_POPPACK
# undef __WINE_PSHPACK_H
# endif
/* Depth == 1 */
# if defined(__GNUC__) || defined(__SUNPRO_C)
# pragma pack()
# elif defined(__SUNPRO_CC)
#warning "Assumes default alignment is 4"
# warning "Assuming a default alignment of 4"
# pragma pack(4)
# elif !defined(RC_INVOKED)
#error "Restoration of the previous alignment isn't supported by the compiler"
#endif /* defined(__GNUC__) || defined(__SUNPRO_C) ; !defined(RC_INVOKED) */
# error "Adjusting the alignment is not supported with this compiler"
# endif
#else
/* Depth == 0 ! */
#else /* defined(__WINE_PSHPACK_H) */
#error "Popping alignment isn't possible since no alignment has been pushed"
#endif /* defined(__WINE_PSHPACK_H) */
#endif
#undef __WINE_INTERNAL_POPPACK

View File

@ -1,13 +1,29 @@
#ifndef __WINE_PSHPACK_H
#if defined(__WINE_PSHPACK_H3)
/* Depth > 3 */
# error "Alignment nesting > 3 is not supported"
#else
# if !defined(__WINE_PSHPACK_H)
# define __WINE_PSHPACK_H 1
/* Depth == 1 */
# elif !defined(__WINE_PSHPACK_H2)
# define __WINE_PSHPACK_H2 1
/* Depth == 2 */
# define __WINE_INTERNAL_POPPACK
# include "poppack.h"
# elif !defined(__WINE_PSHPACK_H3)
# define __WINE_PSHPACK_H3 1
/* Depth == 3 */
# define __WINE_INTERNAL_POPPACK
# include "poppack.h"
# endif
# if defined(__GNUC__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
# pragma pack(1)
# elif !defined(RC_INVOKED)
#error "1 as alignment isn't supported by the compiler"
#endif /* defined(__GNUC__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) ; !defined(RC_INVOKED) */
#else /* !defined(__WINE_PSHPACK_H) */
#error "Nested pushing of alignment isn't supported by the compiler"
#endif /* !defined(__WINE_PSHPACK_H) */
# error "Adjusting the alignment is not supported with this compiler"
# endif
#endif

View File

@ -1,12 +1,29 @@
#ifndef __WINE_PSHPACK_H
#if defined(__WINE_PSHPACK_H3)
/* Depth > 3 */
# error "Alignment nesting > 3 is not supported"
#else
# if !defined(__WINE_PSHPACK_H)
# define __WINE_PSHPACK_H 2
/* Depth == 1 */
# elif !defined(__WINE_PSHPACK_H2)
# define __WINE_PSHPACK_H2 2
/* Depth == 2 */
# define __WINE_INTERNAL_POPPACK
# include "poppack.h"
# elif !defined(__WINE_PSHPACK_H3)
# define __WINE_PSHPACK_H3 2
/* Depth == 3 */
# define __WINE_INTERNAL_POPPACK
# include "poppack.h"
# endif
# if defined(__GNUC__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
# pragma pack(2)
# elif !defined(RC_INVOKED)
#error "2 as alignment isn't supported by the compiler"
#endif /* defined(__GNUC__) || defined(__SUNPRO_CC) ; !defined(RC_INVOKED) */
# error "Adjusting the alignment is not supported with this compiler"
# endif
#else /* !defined(__WINE_PSHPACK_H) */
#error "Nested pushing of alignment isn't supported by the compiler"
#endif /* !defined(__WINE_PSHPACK_H) */
#endif

View File

@ -1,15 +1,29 @@
#ifndef __WINE_PSHPACK_H
#if defined(__WINE_PSHPACK_H3)
/* Depth > 3 */
# error "Alignment nesting > 3 is not supported"
#else
# if !defined(__WINE_PSHPACK_H)
# define __WINE_PSHPACK_H 4
/* Depth == 1 */
# elif !defined(__WINE_PSHPACK_H2)
# define __WINE_PSHPACK_H2 4
/* Depth == 2 */
# define __WINE_INTERNAL_POPPACK
# include "poppack.h"
# elif !defined(__WINE_PSHPACK_H3)
# define __WINE_PSHPACK_H3 4
/* Depth == 3 */
# define __WINE_INTERNAL_POPPACK
# include "poppack.h"
# endif
#if defined(__GNUC__) || defined(__SUNPRO_CC)
# if defined(__GNUC__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
# pragma pack(4)
#elif defined(__SUNPRO_C)
#pragma pack()
# elif !defined(RC_INVOKED)
#error "4 as alignment isn't supported by the compiler"
#endif /* defined(__GNUC__) || defined(__SUNPRO_CC) ; !defined(RC_INVOKED) */
#else /* !defined(__WINE_PSHPACK_H) */
#error "Nested pushing of alignment isn't supported by the compiler"
#endif /* !defined(__WINE_PSHPACK_H) */
# error "Adjusting the alignment is not supported with this compiler"
# endif
#endif

View File

@ -1,12 +1,30 @@
#ifndef __WINE_PSHPACK_H
#if defined(__WINE_PSHPACK_H3)
/* Depth > 3 */
# error "Alignment nesting > 3 is not supported"
#else
# if !defined(__WINE_PSHPACK_H)
# define __WINE_PSHPACK_H 8
/* Depth == 1 */
# elif !defined(__WINE_PSHPACK_H2)
# define __WINE_PSHPACK_H2 8
/* Depth == 2 */
# define __WINE_INTERNAL_POPPACK
# include "poppack.h"
# elif !defined(__WINE_PSHPACK_H3)
# define __WINE_PSHPACK_H3 8
/* Depth == 3 */
# define __WINE_INTERNAL_POPPACK
# include "poppack.h"
# endif
#if 0
# if defined(__GNUC__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
# pragma pack(8)
# warning "8 as alignment is not supported"
# elif !defined(RC_INVOKED)
#error "8 as alignment is not supported"
#endif /* 0 ; !defined(RC_INVOKED) */
# error "Adjusting the alignment is not supported with this compiler"
# endif
#else /* !defined(__WINE_PSHPACK_H) */
#error "Nested pushing of alignment isn't supported by the compiler"
#endif /* !defined(__WINE_PSHPACK_H) */
#endif