Skip to content

Commit

Permalink
m3core: Fix missing visibility pop. (#627)
Browse files Browse the repository at this point in the history
Now single cm3 compiles and links (well, two file because of MaxError).
  • Loading branch information
jaykrell authored Jun 7, 2021
1 parent 2c1e0d0 commit 466ac2c
Show file tree
Hide file tree
Showing 13 changed files with 69 additions and 8 deletions.
17 changes: 16 additions & 1 deletion m3-libs/m3core/src/Csupport/Common/dtoa.h
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,18 @@ static double private_mem[PRIVATE_mem], *pmem_next = private_mem;
#include <float.h>
#endif /* Bad_float_h */

#if __GNUC__ >= 4
// This is disabled.
// There are warnings about inconsistencies.
// There is not all that much code that it affects.
// We should be more worried the m3c output than the hand written C.
// It is not clearly worth the platform-specificity.
#if 0 /* __GNUC__ >= 4 && !defined(__osf__) && !defined(__CYGWIN__) */
#define M3_HAS_VISIBILITY 1
#else
#define M3_HAS_VISIBILITY 0
#endif

#if M3_HAS_VISIBILITY
#ifdef __APPLE__
#pragma GCC visibility push(default)
#else
Expand Down Expand Up @@ -3343,3 +3354,7 @@ m3_dtoa
#ifdef __cplusplus
}
#endif

#if M3_HAS_VISIBILITY
#pragma GCC visibility pop
#endif
8 changes: 6 additions & 2 deletions m3-libs/m3core/src/Csupport/Common/hand.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "m3core.h"
#endif

#if __GNUC__ >= 4
#if M3_HAS_VISIBILITY
#ifdef __APPLE__
#pragma GCC visibility push(default)
#else
Expand Down Expand Up @@ -123,7 +123,7 @@ m3_mod64(INT64 b, INT64 a)
return (bneg ? -a : a);
}
}


// in M3C.m3 and hand.c
#define SET_GRAIN (sizeof(WORD_T) * 8)

Expand Down Expand Up @@ -333,3 +333,7 @@ m3_rotate64(UINT64 value, int shift)
#ifdef __cplusplus
} /* extern "C" */
#endif

#if M3_HAS_VISIBILITY
#pragma GCC visibility pop
#endif
4 changes: 4 additions & 0 deletions m3-libs/m3core/src/thread/Common/ThreadInternal.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,7 @@ ThreadInternal__Select(int nfds,
#endif

M3_EXTERNC_END

#if M3_HAS_VISIBILITY
#pragma GCC visibility pop
#endif
4 changes: 4 additions & 0 deletions m3-libs/m3core/src/thread/POSIX/ThreadPosixC.c
Original file line number Diff line number Diff line change
Expand Up @@ -350,3 +350,7 @@ ThreadPosix__SetVirtualTimer(void)
}

M3_EXTERNC_END

#if M3_HAS_VISIBILITY
#pragma GCC visibility pop
#endif
4 changes: 4 additions & 0 deletions m3-libs/m3core/src/thread/PTHREAD/ThreadApple.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,7 @@ ThreadPThread__ProcessStopped (m3_pthread_t mt, void *bottom, void *context,
#endif /* Apple */

M3_EXTERNC_END

#if M3_HAS_VISIBILITY
#pragma GCC visibility pop
#endif
4 changes: 4 additions & 0 deletions m3-libs/m3core/src/thread/PTHREAD/ThreadFreeBSD.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,7 @@ ThreadPThread__ProcessStopped (m3_pthread_t mt, char *bottom, char *context,
#endif // 0

M3_EXTERNC_END

#if M3_HAS_VISIBILITY
#pragma GCC visibility pop
#endif
6 changes: 6 additions & 0 deletions m3-libs/m3core/src/thread/PTHREAD/ThreadOpenBSD.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// OpenBSD 5.2 dropped thread suspend/resume,
// and ThreadPThread__ProcessStopped does not seem to work here either.
void __cdecl ThreadOpenBSD__Dummy(void) { } /* avoid empty file */

#if 0
/* Copyright (C) 2005, Purdue Research Foundation */
/* All rights reserved. */
Expand Down Expand Up @@ -87,4 +88,9 @@ ThreadPThread__ProcessStopped (m3_pthread_t mt, char *bottom, char *context,
#endif /* OpenBSD */

M3_EXTERNC_END

#if M3_HAS_VISIBILITY
#pragma GCC visibility pop
#endif

#endif
4 changes: 4 additions & 0 deletions m3-libs/m3core/src/thread/PTHREAD/ThreadPThreadC.c
Original file line number Diff line number Diff line change
Expand Up @@ -596,3 +596,7 @@ ThreadPThread__Solaris(void)
}

M3_EXTERNC_END

#if M3_HAS_VISIBILITY
#pragma GCC visibility pop
#endif
2 changes: 1 addition & 1 deletion m3-libs/m3core/src/time/POSIX/DatePosixC.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "m3core.h"
#endif

#if __GNUC__ >= 4
#if M3_HAS_VISIBILITY
#pragma GCC visibility push(hidden)
#endif

Expand Down
6 changes: 5 additions & 1 deletion m3-libs/m3core/src/time/POSIX/TimePosixC.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ We use gettimeofday() which returns seconds and microseconds.
#include "m3core.h"
#endif

#if __GNUC__ >= 4
#if M3_HAS_VISIBILITY
#pragma GCC visibility push(hidden)
#endif

Expand Down Expand Up @@ -138,3 +138,7 @@ TimePosix__ComputeGrain(void)
#ifdef __cplusplus
} /* extern C */
#endif

#if M3_HAS_VISIBILITY
#pragma GCC visibility pop
#endif
6 changes: 5 additions & 1 deletion m3-libs/m3core/src/unix/Common/Uconstants.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
extern "C" {
#endif

#if __GNUC__ >= 4
#if M3_HAS_VISIBILITY
#ifdef __APPLE__
#pragma GCC visibility push(default)
#else
Expand Down Expand Up @@ -1490,3 +1490,7 @@ X(XTABS)
#ifdef __cplusplus
}
#endif

#if M3_HAS_VISIBILITY
#pragma GCC visibility pop
#endif
6 changes: 5 additions & 1 deletion m3-libs/m3core/src/unix/Common/UnixLink.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <windows.h>
#endif

#if __GNUC__ >= 4
#if M3_HAS_VISIBILITY
#ifdef __APPLE__
#pragma GCC visibility push(default)
#else
Expand Down Expand Up @@ -40,3 +40,7 @@ Unix__link(const char* ExistingFile, const char* NewLink)
#ifdef __cplusplus
} /* extern C */
#endif

#if M3_HAS_VISIBILITY
#pragma GCC visibility pop
#endif
6 changes: 5 additions & 1 deletion m3-libs/m3core/src/unix/Common/UstatC.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "m3core.h"
#endif

#if __GNUC__ >= 4
#if M3_HAS_VISIBILITY
#ifdef __APPLE__
#pragma GCC visibility push(default)
#else
Expand Down Expand Up @@ -108,3 +108,7 @@ M3WRAP2(int, fchflags, int, unsigned long)
#ifdef __cplusplus
} /* extern "C" */
#endif

#if M3_HAS_VISIBILITY
#pragma GCC visibility pop
#endif

0 comments on commit 466ac2c

Please sign in to comment.