mattn / go-sqlite3

sqlite3 driver for go using database/sql
http://mattn.github.io/go-sqlite3
MIT License
8.05k stars 1.11k forks source link

Fix deliberate_fall_through macro for LLVM #1254

Closed r-barnes closed 4 months ago

r-barnes commented 5 months ago

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 commented 5 months ago

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

rittneje commented 5 months ago

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.

r-barnes commented 4 months ago

@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.

rittneje commented 4 months ago

@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.

r-barnes commented 4 months ago

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