Skip to content

Commit

Permalink
Various tweaks for building with clang
Browse files Browse the repository at this point in the history
* Change non-static inline function bp_sched2ix to macro and move
  to header file
* '-no-cpp-precomp' no longer needed since Apple GCC 3.3. It results
  many warning when building with clang.
* cast to (void*) in GoTo macro
* Use `void' for empty parameter declaration instead of _VOID_.
  Clang generates an error for a parameter list without types in
  function declaration, while gcc generates a warning.
  • Loading branch information
lht committed Jul 23, 2011
1 parent a3d8134 commit d57d2f4
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 27 deletions.
1 change: 0 additions & 1 deletion erts/configure.in
Expand Up @@ -497,7 +497,6 @@ CFLAG_RUNTIME_LIBRARY_PATH="-Wl,-R"
case $host_os in
darwin*)
CFLAG_RUNTIME_LIBRARY_PATH=
CFLAGS="$CFLAGS -no-cpp-precomp"
;;
win32)
CFLAG_RUNTIME_LIBRARY_PATH=
Expand Down
10 changes: 0 additions & 10 deletions erts/emulator/beam/beam_bp.c
Expand Up @@ -495,16 +495,6 @@ erts_find_local_func(Eterm mfa[3]) {
return NULL;
}

/* bp_hash */
ERTS_INLINE Uint bp_sched2ix() {
#ifdef ERTS_SMP
ErtsSchedulerData *esdp;
esdp = erts_get_scheduler_data();
return esdp->no - 1;
#else
return 0;
#endif
}
static void bp_hash_init(bp_time_hash_t *hash, Uint n) {
Uint size = sizeof(bp_data_time_item_t)*n;
Uint i;
Expand Down
6 changes: 5 additions & 1 deletion erts/emulator/beam/beam_bp.h
Expand Up @@ -144,7 +144,11 @@ extern erts_smp_spinlock_t erts_bp_lock;
#define ErtsSmpBPUnlock(BDC)
#endif

ERTS_INLINE Uint bp_sched2ix(void);
#ifdef ERTS_SMP
#define bp_sched2ix() (erts_get_scheduler_data()->no - 1)
#else
#define bp_sched2ix() (0)
#endif

#ifdef ERTS_SMP
#define bp_sched2ix_proc(p) ((p)->scheduler_data->no - 1)
Expand Down
2 changes: 1 addition & 1 deletion erts/emulator/beam/beam_emu.c
Expand Up @@ -52,7 +52,7 @@
#else
# define OpCase(OpCode) lb_##OpCode
# define CountCase(OpCode) lb_count_##OpCode
# define Goto(Rel) goto *(Rel)
# define Goto(Rel) goto *((void*)Rel)
# define LabelAddr(Label) &&Label
# define OpCode(OpCode) (&&lb_##OpCode)
#endif
Expand Down
3 changes: 2 additions & 1 deletion erts/emulator/beam/erl_nif.c
Expand Up @@ -1616,7 +1616,8 @@ BIF_RETTYPE load_nif_2(BIF_ALIST_2)
}
else { /* Function traced, patch the original instruction word */
BpData** bps = (BpData**) code_ptr[1];
BpData* bp = (BpData*) bps[bp_sched2ix()];
int bpi = bp_sched2ix();
BpData* bp = (BpData*) bps[bpi];
bp->orig_instr = (BeamInstr) BeamOp(op_call_nif);
}
code_ptr[5+1] = (BeamInstr) entry->funcs[i].fptr;
Expand Down
6 changes: 0 additions & 6 deletions lib/erl_interface/configure.in
Expand Up @@ -338,12 +338,6 @@ AC_SUBST(LIB_CFLAGS)
if test "X$host" = "Xwin32"; then
LIB_CFLAGS="$CFLAGS"
else
case $host_os in
darwin*)
CFLAGS="$CFLAGS -no-cpp-precomp"
;;
esac

if test "x$GCC" = xyes; then
LIB_CFLAGS="$CFLAGS -fPIC"
else
Expand Down
6 changes: 0 additions & 6 deletions lib/megaco/configure.in
Expand Up @@ -206,12 +206,6 @@ dnl
if test "X$host" = "Xwin32"; then
DED_CFLAGS="$CFLAGS"
else
case $host_os in
darwin*)
CFLAGS="$CFLAGS -no-cpp-precomp -fno-common"
;;
esac

if test "x$GCC" = xyes; then
DED_CFLAGS="$CFLAGS -fPIC $DED_CFLAGS"
else
Expand Down
1 change: 0 additions & 1 deletion lib/wx/configure.in
Expand Up @@ -161,7 +161,6 @@ esac

case $host_os in
darwin*)
CFLAGS="-no-cpp-precomp $CFLAGS"
LDFLAGS="-bundle -flat_namespace -undefined warning -fPIC $LDFLAGS"
GL_LIBS="-framework OpenGL"
;;
Expand Down

0 comments on commit d57d2f4

Please sign in to comment.