Skip to content

Conversation

@probablytom
Copy link

There's such a thing as a "fallthrough statement", which GNUTLS also uses. This implementation has a couple of issues so it's very much WIP...:

  • It shouldn't prohibit the use of [[fallthrough]] as an attribute, which should be allowed too, but currently [[fallthrough]] must be a "fallthrough statement"
  • It defines a couple of different forms, and I'm not sure they're all valid ([[fallthrough]], [[FALLTHROUGH]], [[__fallthrough__]]), so I need to revisit and remove the invalid forms

Bit of a strange one but GNUTLS wanted it. Progress progress.

Adds _basic_ support for attribute specifier sequences. They can have
extra syntax (e.g. namespaces indicating the compiler attributes are
available in) but right now we don't bother with that and treat them as
attributes within double square brackets, which seems to suffice for
e.g. GNUTLS.
There's a new statement from C17 --- `[[fallthrough]]` --- which we
don't support yet. GNUTLS uses it.

It seems a little redundant to me? Seemingly it's supposed to indicate
to the compiler that fallthrough really is expected somewhere. This adds
it as a new type of statement, albeit with some hacky bits in the lexer.
@stephenrkell
Copy link
Owner

Thanks Tom. Just to help my understanding: fallthrough seems like a statement-level attribute. Is that right? Does CIL support any other statement-level attributes so far?

Just out of interest, can you point me at some gnutls code where this is used? I am curious to see whether they have guarded it on C23 support. If they are using it unguardedly, that seems very bleeding-edge for such a widely-used package. If they have a guard, we might want to make use of it rather than get dragged into C23 support when other things may be more pressing.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants