aboutsummaryrefslogtreecommitdiff
path: root/tcc.h
diff options
context:
space:
mode:
authorgrischka <grischka>2009-12-06 17:37:33 +0100
committergrischka <grischka>2009-12-06 17:37:33 +0100
commit56d6abdb3dfa6dd51934164969123c07296ef6af (patch)
tree542fc84920a1402ae7498a6a6c6d40758dd8c175 /tcc.h
parentc0620c8a00f760765da802dc11e4863193e357e8 (diff)
downloadtinycc-56d6abdb3dfa6dd51934164969123c07296ef6af.tar.gz
tinycc-56d6abdb3dfa6dd51934164969123c07296ef6af.tar.bz2
tccgen: propagate alignment from typedef
Store (part of) the AttributeDef structure in the (int)sym-r field of the typedef symbol (kludgy).
Diffstat (limited to 'tcc.h')
-rw-r--r--tcc.h41
1 files changed, 15 insertions, 26 deletions
diff --git a/tcc.h b/tcc.h
index b481981..59384b4 100644
--- a/tcc.h
+++ b/tcc.h
@@ -46,9 +46,6 @@
#include <direct.h> /* getcwd */
#define inline __inline
#define inp next_inp
-#ifdef _MSC_VER
-#define __aligned(n) __declspec(align(n))
-#endif
#ifdef _WIN64
#define uplong unsigned long long
#endif
@@ -67,10 +64,6 @@
#define uplong unsigned long
#endif
-#ifndef __aligned
-#define __aligned(n) __attribute__((aligned(n)))
-#endif
-
#ifndef PAGESIZE
#define PAGESIZE 4096
#endif
@@ -263,26 +256,25 @@ typedef struct DLLReference {
/* GNUC attribute definition */
typedef struct AttributeDef {
- int aligned;
- int packed;
- Section *section;
- int func_attr; /* calling convention, exports, ... */
+ unsigned
+ packed : 1,
+ aligned : 5, /* alignement (0..16) */
+ func_call : 3, /* calling convention (0..5), see below */
+ func_export : 1,
+ func_import : 1,
+ func_args : 8;
+ struct Section *section;
} AttributeDef;
-/* -------------------------------------------------- */
/* gr: wrappers for casting sym->r for other purposes */
-typedef struct {
- unsigned
- func_call : 8,
- func_args : 8,
- func_export : 1,
- func_import : 1;
-} func_attr_t;
+#define FUNC_CALL(r) (((AttributeDef*)&(r))->func_call)
+#define FUNC_EXPORT(r) (((AttributeDef*)&(r))->func_export)
+#define FUNC_IMPORT(r) (((AttributeDef*)&(r))->func_import)
+#define FUNC_ARGS(r) (((AttributeDef*)&(r))->func_args)
+#define FUNC_ALIGN(r) (((AttributeDef*)&(r))->aligned)
+#define FUNC_PACKED(r) (((AttributeDef*)&(r))->packed)
+#define INT_ATTR(ad) (*(int*)(ad))
-#define FUNC_CALL(r) (((func_attr_t*)&(r))->func_call)
-#define FUNC_EXPORT(r) (((func_attr_t*)&(r))->func_export)
-#define FUNC_IMPORT(r) (((func_attr_t*)&(r))->func_import)
-#define FUNC_ARGS(r) (((func_attr_t*)&(r))->func_args)
/* -------------------------------------------------- */
#define SYM_STRUCT 0x40000000 /* struct/union/enum symbol space */
@@ -480,9 +472,6 @@ struct TCCState {
void *error_opaque;
void (*error_func)(void *opaque, const char *msg);
int error_set_jmp_enabled;
-#ifdef _WIN64
- __aligned(16)
-#endif
jmp_buf error_jmp_buf;
int nb_errors;