Skip to content

Commit

Permalink
Revert the .inline semantics change (nim-lang#22104)
Browse files Browse the repository at this point in the history
  • Loading branch information
juancarlospaco authored Jun 15, 2023
1 parent 4937aa9 commit 0a19d78
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 22 deletions.
2 changes: 0 additions & 2 deletions changelogs/changelog_2_0_0.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,6 @@
declared when they are not available on the backend. Previously it would call
`doAssert false` at runtime despite the condition being compile-time.

- Pragma `{.inline.}` generates `__forceinline` if `__has_attribute(__forceinline)` for GCC and Clang.

- `strutils.split` and `strutils.rsplit` now forbid an empty separator.

- Relative imports will not resolve to searched paths anymore, e.g. `import ./tables` now reports an error properly.
Expand Down
31 changes: 11 additions & 20 deletions lib/nimbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,29 +84,20 @@ __AVR__
# define __DECLSPEC_SUPPORTED 1
#endif


/* Calling conventions and inline attributes for the supported C compilers */
#if defined(__GNUC__) || defined(__clang__) /* GCC and Clang */
# if __has_attribute(__forceinline)
# define N_INLINE(rettype, name) __attribute__((__forceinline)) rettype name
# else
# define N_INLINE(rettype, name) inline rettype name
# endif
#elif defined(_MSC_VER) /* MSVC */
# if _MSC_VER > 1200
# define N_INLINE(rettype, name) __forceinline rettype name
# else
# define N_INLINE(rettype, name) inline rettype name
# endif
#elif defined(__TINYC__) || defined(__BORLANDC__) /* TinyC and BorlandC */
# define N_INLINE(rettype, name) __inline rettype name
#elif defined(__AVR__) /* Atmel Advanced Virtual RISC */
/* calling convention mess ----------------------------------------------- */
#if defined(__GNUC__) || defined(__TINYC__)
/* these should support C99's inline */
# define N_INLINE(rettype, name) inline rettype name
#else /* Unsupported C compilers */
# define N_INLINE(rettype, name) rettype name
#elif defined(__BORLANDC__) || defined(_MSC_VER)
/* Borland's compiler is really STRANGE here; note that the __fastcall
keyword cannot be before the return type, but __inline cannot be after
the return type, so we do not handle this mess in the code generator
but rather here. */
# define N_INLINE(rettype, name) __inline rettype name
#else /* others are less picky: */
# define N_INLINE(rettype, name) rettype __inline name
#endif


#define N_INLINE_PTR(rettype, name) rettype (*name)

#if defined(__cplusplus)
Expand Down

0 comments on commit 0a19d78

Please sign in to comment.