New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass noReturn pragma to C code. #2657

Merged
merged 4 commits into from May 8, 2015

Conversation

Projects
None yet
3 participants
@def-
Copy link
Member

def- commented May 4, 2015

With GCC and Clang this generates __attribute__((noreturn)) in the function declaration. (both tested) With VCC __declspec(noreturn) is used.

Pass noReturn pragma to C code.
With GCC and Clang this generates __attribute__((noreturn)) in the
function declaration. (both tested) With VCC __declspec(noreturn) is
used.

@def- def- force-pushed the def-:noreturn branch from 048e92f to a9fe618 May 4, 2015

@@ -27,7 +27,9 @@ type
hasGcGuard, # CC supports GC_GUARD to keep stack roots
hasGnuAsm, # CC's asm uses the absurd GNU assembler syntax
hasNakedDeclspec, # CC has __declspec(naked)
hasNakedAttribute # CC has __attribute__((naked))
hasNakedAttribute, # CC has __attribute__((naked))

This comment has been minimized.

@Araq

Araq May 5, 2015

Member

I think it suffices to distinguish between attribute and __declspec at this point.

This comment has been minimized.

@def-

def- May 5, 2015

Member

So I should just make it hasAttribute and hasDeclspec which includes compatibility for both naked and noreturn implicitly?

@def-

This comment has been minimized.

Copy link
Member

def- commented May 5, 2015

This causes a problem with nimkernel. When you overwrite panic or sysFatal so that they return, then the noreturn pragma in system/chcks.nim is no longer true. Not sure how this should be fixed.

def- added some commits May 5, 2015

Move the noreturn pragma to sysFatal
Now you can choose to implement sysFatal with --os:standalone so that it
returns.
@def-

This comment has been minimized.

Copy link
Member

def- commented May 5, 2015

I think it's alright now.

hasDeclspec, # CC has __declspec(X)
hasAttribute, # CC has __attribute__((X))
hasNaked, # CC has naked declspec/attribute
hasNoreturn # CC has noreturn declspec/attribute

This comment has been minimized.

@Araq

Araq May 7, 2015

Member

That's not what I meant. Assume that hasDeclspec implies that both __declspec(naked) and __declspec(noreturn) are available. Likewise for hasAttribute. I don't think there are compilers where this assumption does not hold.

This comment has been minimized.

@def-

def- May 7, 2015

Member

Alright, here we go.

Araq added a commit that referenced this pull request May 8, 2015

Merge pull request #2657 from def-/noreturn
Pass noReturn pragma to C code.

@Araq Araq merged commit 9422dbf into nim-lang:devel May 8, 2015

@yglukhov

This comment has been minimized.

Copy link
Member

yglukhov commented May 15, 2015

This PR has introduced a regression: #2696.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment