From: Paul Eggert Date: Tue, 2 Jul 2019 23:33:04 +0000 (-0700) Subject: verify: document ‘assume’ better X-Git-Tag: v1.0~4800 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=c882996026931d9b11b0878a9bb032ca6b3941dd;p=gnulib.git verify: document ‘assume’ better * lib/verify.h: Reword doc (Bug#36370). --- diff --git a/ChangeLog b/ChangeLog index 77d8e9e6a0..b89fd5d9e5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2019-07-02 Paul Eggert + + verify: document ‘assume’ better + * lib/verify.h: Reword doc (Bug#36370). + 2019-07-02 Bruno Haible localcharset, nl_langinfo: Fix return value for UTF-8 locales on MSVC. diff --git a/lib/verify.h b/lib/verify.h index f8e4eff026..9b8e1ed20f 100644 --- a/lib/verify.h +++ b/lib/verify.h @@ -259,9 +259,11 @@ template # define __has_builtin(x) 0 #endif -/* Assume that R always holds. This lets the compiler optimize - accordingly. R should not have side-effects; it may or may not be - evaluated. Behavior is undefined if R is false. */ +/* Assume that R always holds. Behavior is undefined if R is false, + fails to evaluate, or has side effects. Although assuming R can + help a compiler generate better code or diagnostics, performance + can suffer if R uses hard-to-optimize features such as function + calls not inlined by the compiler. */ #if (__has_builtin (__builtin_unreachable) \ || 4 < __GNUC__ + (5 <= __GNUC_MINOR__))