go-sqlite3 icon indicating copy to clipboard operation
go-sqlite3 copied to clipboard

Fix deliberate_fall_through macro for LLVM

Open r-barnes opened this issue 1 year ago • 2 comments

sqlite3-binding.c current has this code:

/*
** Macro to disable warnings about missing "break" at the end of a "case".
*/
#if GCC_VERSION>=7000000
# define deliberate_fall_through __attribute__((fallthrough));
#else
# define deliberate_fall_through
#endif

but this leaves LLVM without implicit fallthrough protections.

Can we use this instead?

#ifndef ATTRIBUTE_FALLTHROUGH
#  if defined __has_attribute
#    if __has_attribute (fallthrough)
#      define ATTRIBUTE_FALLTHROUGH __attribute__ ((fallthrough))
#    else
#      define ATTRIBUTE_FALLTHROUGH
#    endif
#  endif
#endif

r-barnes avatar Jul 01 '24 17:07 r-barnes

Upstream PR: https://sqlite.org/forum/forumpost/7ec11023dd

r-barnes avatar Jul 01 '24 18:07 r-barnes

We don't make changes directly to the C library. If and when your upstream patch makes it into an official release, it will be pulled in as part of that upgrade.

rittneje avatar Jul 01 '24 20:07 rittneje

@rittneje - Upstream made a patch to fix this problem (link). I hope you'll be able to update so your code will work across different compilers.

r-barnes avatar Jul 15 '24 19:07 r-barnes

@r-barnes Once the change lands in an official SQLite release, we'll pull it in via the standard process. Consequently, I am going to decline this PR.

Please feel free to open an issue requesting an upgrade once the upstream release happens so we don't forget.

rittneje avatar Jul 17 '24 03:07 rittneje

Thanks, @rittneje - I expect I'll forget, but if you do pulls somewhat regularly, it should be okay to let it follow your schedule.

r-barnes avatar Jul 19 '24 17:07 r-barnes