aboutsummaryrefslogtreecommitdiff
path: root/tests/server
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2012-04-14 15:12:30 +0200
committerYang Tse <yangsita@gmail.com>2012-04-14 15:12:30 +0200
commit48d13b44c660cdefaf1a921c974f43ee4df346a2 (patch)
treef1326db7842054f785921620f6dc827665b844ca /tests/server
parent8b63b48627961c0bf880eb4d57cf24d6a828dcd2 (diff)
headers: require GCC 2.7 or newer in order to allow attribute GCC'isms usage
Usage in other code paths already protected and requiring even newer versions.
Diffstat (limited to 'tests/server')
-rw-r--r--tests/server/tftp.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/server/tftp.h b/tests/server/tftp.h
index 461ab9a36..0650efe6a 100644
--- a/tests/server/tftp.h
+++ b/tests/server/tftp.h
@@ -28,8 +28,11 @@
#define SEGSIZE 512 /* data segment size */
-#ifndef __GNUC__
-#define __attribute__(x)
+#if defined(__GNUC__) && ((__GNUC__ >= 3) || \
+ ((__GNUC__ == 2) && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ >= 7)))
+# define PACKED_STRUCT __attribute__((__packed__))
+#else
+# define PACKED_STRUCT /*NOTHING*/
#endif
/* Using a packed struct as binary in a program is begging for problems, but
@@ -40,7 +43,7 @@ struct tftphdr {
short th_opcode; /* packet type */
unsigned short th_block; /* all sorts of things */
char th_data[1]; /* data or error string */
-} __attribute__ ((__packed__));
+} PACKED_STRUCT;
#define th_stuff th_block
#define th_code th_block