tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Limiting -Wno-error=format-truncation to specific GCC version



What would be the best way to limit the following to gcc8 or above? (its not needed in gcc7, 6 or 5 for acpica-utils and I'm assuming there is a version of GCC earlier enough in use that doesn't support it)

.if !empty(PKGSRC_COMPILER:Mgcc)
CFLAGS+=        -Wno-error=format-truncation
.endif

(Background: compiling acpica-utils under gcc8 errored out with a potential sprintf overflow. Patching to use snprintf as below lead to an error as its built with -Werror)

-            sprintf (MsgBuffer, "%s required for %4.4s",
+            snprintf (MsgBuffer, sizeof(MsgBuffer), "%s required for %4.4s",
                 StringBuffer, ThisName->Info.Name);

Alternatively, so I just throw -Wno-error at it or something else :)

David


Home | Main Index | Thread Index | Old Index