aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/global.h
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2011-05-03 14:20:22 +0200
committerBjörn Gustavsson <[email protected]>2011-05-11 09:20:01 +0200
commit8d1dd7079fdcd22765b30a1268649022360f6f56 (patch)
treeded2ecc4254e6668ef4c8ff38081001170a8949d /erts/emulator/beam/global.h
parent2ef48dca9328e0b928117f21bc9ee6dbc5a614cc (diff)
downloadotp-8d1dd7079fdcd22765b30a1268649022360f6f56.tar.gz
otp-8d1dd7079fdcd22765b30a1268649022360f6f56.tar.bz2
otp-8d1dd7079fdcd22765b30a1268649022360f6f56.zip
erl_trace: Eliminate alias warning
Avoid creating two variable names referring to the same memory area, because that can cause aliasing warnings in some versions of gcc.
Diffstat (limited to 'erts/emulator/beam/global.h')
-rw-r--r--erts/emulator/beam/global.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/erts/emulator/beam/global.h b/erts/emulator/beam/global.h
index 96da894d90..857aab2126 100644
--- a/erts/emulator/beam/global.h
+++ b/erts/emulator/beam/global.h
@@ -1890,6 +1890,8 @@ erts_alloc_message_heap(Uint size,
# if defined(DEBUG)
# define DeclareTmpHeap(VariableName,Size,Process) \
Eterm *VariableName = erts_debug_allocate_tmp_heap(Size,Process)
+# define DeclareTypedTmpHeap(Type,VariableName,Process) \
+ Type *VariableName = (Type *) erts_debug_allocate_tmp_heap(sizeof(Type)/sizeof(Eterm),Process)
# define DeclareTmpHeapNoproc(VariableName,Size) \
Eterm *VariableName = erts_debug_allocate_tmp_heap(Size,NULL)
# define UseTmpHeap(Size,Proc) \
@@ -1911,6 +1913,8 @@ erts_alloc_message_heap(Uint size,
# else
# define DeclareTmpHeap(VariableName,Size,Process) \
Eterm *VariableName = (ERTS_PROC_GET_SCHDATA(Process)->tmp_heap)+(ERTS_PROC_GET_SCHDATA(Process)->num_tmp_heap_used)
+# define DeclareTypedTmpHeap(Type,VariableName,Process) \
+ Type *VariableName = (Type *) (ERTS_PROC_GET_SCHDATA(Process)->tmp_heap)+(ERTS_PROC_GET_SCHDATA(Process)->num_tmp_heap_used)
# define DeclareTmpHeapNoproc(VariableName,Size) \
Eterm *VariableName = (erts_get_scheduler_data()->tmp_heap)+(erts_get_scheduler_data()->num_tmp_heap_used)
# define UseTmpHeap(Size,Proc) \
@@ -1936,6 +1940,8 @@ erts_alloc_message_heap(Uint size,
#else
# define DeclareTmpHeap(VariableName,Size,Process) \
Eterm VariableName[Size]
+# define DeclareTypedTmpHeap(Type,VariableName,Process) \
+ Type VariableName[1]
# define DeclareTmpHeapNoproc(VariableName,Size) \
Eterm VariableName[Size]
# define UseTmpHeap(Size,Proc) /* Nothing */