Disable clang's -Wunreachable-code warning

This commit is contained in:
Nigel Tao committed 2020-04-03 21:57:49 +11:00
1 parent ecd3285567
commit 1a1f36ce13
4 files changed
+35 -43

No files matched your search

+20
View File
@@ -101,6 +101,7 @@ func doGenrelease(args []string) error {
unformatted.WriteString("#ifndef WUFFS_INCLUDE_GUARD\n")
unformatted.WriteString("#define WUFFS_INCLUDE_GUARD\n\n")
unformatted.WriteString(grSingleFileGuidance)
unformatted.WriteString(grPragmaPush)
h.seen = map[string]bool{}
for _, f := range h.filesList {
@@ -121,6 +122,7 @@ func doGenrelease(args []string) error {
unformatted.WriteString("\n")
unformatted.Write(grImplEndsHere)
unformatted.WriteString(grPragmaPop)
unformatted.WriteString("\n\n#endif // WUFFS_INCLUDE_GUARD\n\n")
cmd := exec.Command(*cformatterFlag, "-style=Chromium")
@@ -151,6 +153,24 @@ const grSingleFileGuidance = `
`
const grPragmaPush = `
// Wuffs' C code is generated automatically, not hand-written. These warnings'
// costs outweigh the benefits.
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunreachable-code"
#pragma clang diagnostic ignored "-Wunused-function"
#endif
`
const grPragmaPop = `
#ifdef __clang__
#pragma clang diagnostic pop
#endif
`
type parsedCFile struct {
includes []string
// fragments[0] is the header, fragments[1] is the implementation.