Skip to content

Commit

Permalink
Few more improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
torben-hansen committed Feb 26, 2025
1 parent acd4c43 commit 842f1d2
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ static inline void jent_get_nstime(uint64_t *out)
{
uint64_t clk;
/* this is MVS code! enable with -S in the compiler */
/*__asm__ volatile("stck %0" : "=m" (clk) : : "cc"); */
/*__asm__ __volatile__("stck %0" : "=m" (clk) : : "cc"); */
/* this is gcc */
__asm__ __volatile__("stcke %0" : "=Q" (clk) : : "cc");
*out = (uint64_t)(clk);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ static inline void jent_get_nstime(uint64_t *out)
* This is MVS+STCK code! Enable it with -S in the compiler.
*
* uint64_t clk;
* __asm__ volatile("stck %0" : "=m" (clk) : : "cc");
* __asm__ __volatile__("stck %0" : "=m" (clk) : : "cc");
* *out = (uint64_t)(clk);
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,21 @@ extern "C" {

/* Portable switch fall-through to silence warnings. Only works for C. */
#if defined(__GNUC__) && __GNUC__ >= 7 // gcc 7
#define JE_FALLTHROUGH __attribute__ ((fallthrough))
#define JE_FALLTHROUGH __attribute__ ((fallthrough))
#elif defined(__clang__)
/* Separate logic to avoid errors when compiler doesn't understand __has_attribute */
#if __has_attribute(fallthrough) && __clang_major__ >= 5
/*
* Clang 3.5, at least, complains about "error: declaration does not declare
* anything", possibly because we put a semicolon after this macro in
* practice. Thus limit it to >= Clang 5, which does work.
*/
#define JE_FALLTHROUGH __attribute__ ((fallthrough))
#else
#define JE_FALLTHROUGH
#endif
#if defined(__has_attribute) && __has_attribute(fallthrough) && __clang_major__ >= 5
/*
* Clang 3.5, at least, complains about "error: declaration does not declare
* anything", possibly because we put a semicolon after this macro in
* practice. Thus limit it to >= Clang 5, which does work.
*/
#define JE_FALLTHROUGH __attribute__ ((fallthrough))
#else
#define JE_FALLTHROUGH
#endif
#else
#define JE_FALLTHROUGH
#define JE_FALLTHROUGH
#endif

#ifdef __cplusplus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ void jent_get_nstime(__u64 *out)

#elif (defined(__i386__) || defined(__x86_64__))
DECLARE_ARGS(val, low, high);
asm volatile("rdtsc" : EAX_EDX_RET(val, low, high));
__asm__ __volatile__("rdtsc" : EAX_EDX_RET(val, low, high));
*out = EAX_EDX_VAL(val, low, high);

#else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ void jent_get_nstime(__u64 *out)

#elif (defined(__i386__) || defined(__x86_64__))
DECLARE_ARGS(val, low, high);
asm volatile("rdtsc" : EAX_EDX_RET(val, low, high));
__asm__ __volatile__("rdtsc" : EAX_EDX_RET(val, low, high));
*out = EAX_EDX_VAL(val, low, high);

#else
Expand Down

0 comments on commit 842f1d2

Please sign in to comment.