Closed Bug 1683213 Opened 3 years ago Closed 3 years ago

Should we disable "-Wrange-loop-analysis"?

Categories

(Developer Infrastructure :: Source Code Analysis, enhancement)

enhancement

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: mhentges, Assigned: mhentges)

References

Details

Attachments

(1 file)

Simon got hit by an old version of clang warning on code that new clang thought was clean.

It fails because of a -Wrange-loop-analysis warning in a template, which isn't emitted by more recent clang versions. I think I need to manually disable the warning in that file to get around it. See also https://quuxplusone.github.io/blog/2020/08/26/wrange-loop-analysis/ which argues against this particular warning that is not included in either -Wall or -Wextra, and also abseil's rationale for keeping it disabled (https://abseil.io/docs/cpp/platforms/compilerflags#clang-flags), the reason also applying to the particular case we have here, since the value type is an enum type here.

(originally reported in this bug)

Assignee: nobody → mhentges
Status: NEW → ASSIGNED
Priority: -- → P3
See Also: → 1674448

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: General → Source Code Analysis

The component has been changed since the backlog priority was decided, so we're resetting it.
For more information, please visit auto_nag documentation.

Priority: P3 → --

Hmm, those links are convincing, and I'm happy to disable -Wrange-loop-analysis.
FWIW, we have another option: the reason why this failed in your push is because -Wrange-loop-analysis changed from Clang 9 to Clang 10. In Clang 10, it now refers to two sub-flags (-Wrange-loop-bind-reference and -Wrange-loop-construct), both of which don't trigger that same error.

My C++ knowledge is lacking here: Simon, is it valuable to keep either of those sub-flags, or should we entirely disable range loop analysis?

Thanks for taking care to carry this over into this new bug!

Isn't the base-toolchain build still using clang 5.0? I was only referring to that one.

In the regular builds, I am quite sure this warning was triggered, so I guess it's fine to leave it as is there. Maybe there was some change to the warning, maybe related to the split you mentioned, in more recent clang versions that makes the concerns raised in the links obsolete.

Ok, makes sense. I'll adjust the warnings so that the one you ran into with clang 5 doesn't pop up, but the modern ones will :)

Old clang shakes its fist when auto&& item : range is used with a
range
that returns values instead of references.
Modern clang doesn't warn for this scenario, so we disable the
warning.

Also removes pragmas that manually disable this warning.

Pushed by mhentges@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/9d5f4c9e6fdf
Don't warn on range-loop-analysis for clang < 10 r=sheehan,sg,firefox-build-system-reviewers,andi,glandium

Backed out changeset 9d5f4c9e6fdf (bug 1683213) for nsReadableUtils related bustage.

Push with failure: https://treeherder.mozilla.org/jobs?repo=autoland&group_state=expanded&selectedTaskRun=MfhVTalpSkmp_RPqc5-Hdg.0&fromchange=9d5f4c9e6fdf71853bf496c79a4101018b26e2e1&searchStr=osx%2Cdebug%2Cbuild-macosx64-plain%2Fdebug%2Cbp&tochange=6c4209f41b69bb6111ed14a8ea001feec0b243c3

Backout link: https://hg.mozilla.org/integration/autoland/rev/6c4209f41b69bb6111ed14a8ea001feec0b243c3

Failure log: https://treeherder.mozilla.org/logviewer?job_id=325758321&repo=autoland&lineNumber=3597

[task 2021-01-04T15:30:17.454Z] 15:30:17     INFO -  In file included from Unified_cpp_docshell_base0.cpp:2:
[task 2021-01-04T15:30:17.455Z] 15:30:17     INFO -  In file included from /private/var/opt/generic-worker/tasks/task_160969589330515/checkouts/gecko/docshell/base/BaseHistory.cpp:7:
[task 2021-01-04T15:30:17.455Z] 15:30:17     INFO -  In file included from /private/var/opt/generic-worker/tasks/task_160969589330515/checkouts/gecko/docshell/base/BaseHistory.h:8:
[task 2021-01-04T15:30:17.456Z] 15:30:17     INFO -  In file included from /private/var/opt/generic-worker/tasks/task_160969589330515/checkouts/gecko/docshell/base/IHistory.h:11:
[task 2021-01-04T15:30:17.456Z] 15:30:17     INFO -  In file included from /private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/dist/include/nsDataHashtable.h:10:
[task 2021-01-04T15:30:17.456Z] 15:30:17     INFO -  In file included from /private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/dist/include/nsHashKeys.h:16:
[task 2021-01-04T15:30:17.457Z] 15:30:17     INFO -  In file included from /private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/dist/include/nsString.h:18:
[task 2021-01-04T15:30:17.457Z] 15:30:17    ERROR -  /private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/dist/include/nsReadableUtils.h:456:20: error: loop variable 'item' is always a copy because the range of type 'const mozilla::EnumSet<unsigned long, unsigned long long>' does not return a reference [-Werror,-Wrange-loop-analysis]
[task 2021-01-04T15:30:17.458Z] 15:30:17     INFO -    for (const auto& item : aInputRange) {
[task 2021-01-04T15:30:17.458Z] 15:30:17     INFO -                     ^
[task 2021-01-04T15:30:17.459Z] 15:30:17     INFO -  /private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/dist/include/nsReadableUtils.h:484:3: note: in instantiation of function template specialization 'StringJoinAppend<char, mozilla::EnumSet<unsigned long, unsigned long long>, (lambda at /private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/dist/include/mozilla/dom/SyncedContextInlines.h:25:21)>' requested here
[task 2021-01-04T15:30:17.459Z] 15:30:17     INFO -    StringJoinAppend(res, aSeparator, aInputRange, std::forward<Func>(aFunc));
[task 2021-01-04T15:30:17.459Z] 15:30:17     INFO -    ^
[task 2021-01-04T15:30:17.460Z] 15:30:17     INFO -  /private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/dist/include/mozilla/dom/SyncedContextInlines.h:38:23: note: in instantiation of function template specialization 'mozilla::dom::syncedcontext::FormatValidationError<mozilla::dom::BrowsingContext>' requested here
[task 2021-01-04T15:30:17.460Z] 15:30:17     INFO -      nsCString error = FormatValidationError<Context>(
[task 2021-01-04T15:30:17.460Z] 15:30:17     INFO -                        ^
[task 2021-01-04T15:30:17.461Z] 15:30:17     INFO -  /private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/dist/include/nsReadableUtils.h:456:8: note: use non-reference type 'unsigned long'
[task 2021-01-04T15:30:17.461Z] 15:30:17     INFO -    for (const auto& item : aInputRange) {
[task 2021-01-04T15:30:17.461Z] 15:30:17     INFO -         ^~~~~~~~~~~~~~~~~~
[task 2021-01-04T15:30:17.649Z] 15:30:17     INFO -  config/external/icu/common/normalizer2.o
[task 2021-01-04T15:30:17.654Z] 15:30:17     INFO -  /usr/bin/clang++ -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -std=gnu++17 -o messagepattern.o -c  -fvisibility=hidden -fvisibility-inlines-hidden -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -ftrivial-auto-var-init=pattern -DDEBUG=1 -DU_COMMON_IMPLEMENTATION -DU_USING_ICU_NAMESPACE=0 -DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1 -DU_HIDE_OBSOLETE_UTF_OLD_H=1 -DUCONFIG_NO_LEGACY_CONVERSION -DUCONFIG_NO_TRANSLITERATION -DUCONFIG_NO_REGULAR_EXPRESSIONS -DU_CHARSET_IS_UTF8 -DUNISTR_FROM_CHAR_EXPLICIT=explicit -DUNISTR_FROM_STRING_EXPLICIT=explicit -DU_ENABLE_DYLOAD=0 -DU_HAVE_NL_LANGINFO_CODESET=0 -DU_DEBUG=1 -I/private/var/opt/generic-worker/tasks/task_160969589330515/checkouts/gecko/config/external/icu/common -I/private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/config/external/icu/common -I/private/var/opt/generic-worker/tasks/task_160969589330515/checkouts/gecko/intl/icu/source/i18n -I/private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/dist/include -I/private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/dist/include/nspr -I/private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/dist/include/nss -fPIC -DMOZILLA_CLIENT -include /private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/mozilla-config.h -Qunused-arguments -Qunused-arguments -Wall -Wbitfield-enum-conversion -Wempty-body -Wignored-qualifiers -Woverloaded-virtual -Wpointer-arith -Wshadow-field-in-constructor-modified -Wsign-compare -Wtype-limits -Wunreachable-code -Wunreachable-code-return -Wwrite-strings -Wno-invalid-offsetof -Wclass-varargs -Wempty-init-stmt -Wfloat-overflow-conversion -Wfloat-zero-conversion -Wloop-analysis -Wc++2a-compat -Wcomma -Wimplicit-fallthrough -Wunused-function -Wunused-variable -Werror=non-literal-null-conversion -Wstring-conversion -Wtautological-overlap-compare -Wtautological-unsigned-enum-zero-compare -Wtautological-unsigned-zero-compare -Wno-error=tautological-type-limit-compare -Wno-inline-new-delete -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=backend-plugin -Wno-error=return-std-move -Wno-error=atomic-alignment -Wformat -Wformat-security -Wno-gnu-zero-variadic-macro-arguments -Wno-unknown-warning-option -fno-sized-deallocation -fno-aligned-new -fno-exceptions -fno-strict-aliasing -stdlib=libc++ -fno-rtti -ffunction-sections -fdata-sections -fno-exceptions -fno-math-errno -pthread -pipe -g -O3 -fno-omit-frame-pointer -funwind-tables -Wno-deprecated-declarations -Wno-type-limits -Wno-unused-but-set-variable -Wno-unused-function -Wno-sign-compare -Wno-maybe-uninitialized -frtti -Wno-c++20-compat -Wno-comma -Wno-implicit-const-int-float-conversion -Wno-macro-redefined -Wno-microsoft-include -Wno-tautological-unsigned-enum-zero-compare -Wno-unreachable-code-loop-increment -Wno-unreachable-code-return  -MD -MP -MF .deps/messagepattern.o.pp   /private/var/opt/generic-worker/tasks/task_160969589330515/checkouts/gecko/intl/icu/source/common/messagepattern.cpp
[task 2021-01-04T15:30:18.084Z] 15:30:18     INFO -  config/external/icu/i18n/compactdecimalformat.o
[task 2021-01-04T15:30:18.089Z] 15:30:18     INFO -  /usr/bin/clang++ -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -std=gnu++17 -o collationweights.o -c  -fvisibility=hidden -fvisibility-inlines-hidden -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -ftrivial-auto-var-init=pattern -DDEBUG=1 -DU_I18N_IMPLEMENTATION -DU_USING_ICU_NAMESPACE=0 -DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1 -DU_HIDE_OBSOLETE_UTF_OLD_H=1 -DUCONFIG_NO_LEGACY_CONVERSION -DUCONFIG_NO_TRANSLITERATION -DUCONFIG_NO_REGULAR_EXPRESSIONS -DU_CHARSET_IS_UTF8 -DUNISTR_FROM_CHAR_EXPLICIT=explicit -DUNISTR_FROM_STRING_EXPLICIT=explicit -DU_ENABLE_DYLOAD=0 -DU_HAVE_NL_LANGINFO_CODESET=0 -DU_DEBUG=1 -I/private/var/opt/generic-worker/tasks/task_160969589330515/checkouts/gecko/config/external/icu/i18n -I/private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/config/external/icu/i18n -I/private/var/opt/generic-worker/tasks/task_160969589330515/checkouts/gecko/intl/icu/source/common -I/private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/dist/include -I/private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/dist/include/nspr -I/private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/dist/include/nss -fPIC -DMOZILLA_CLIENT -include /private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/mozilla-config.h -Qunused-arguments -Qunused-arguments -Wall -Wbitfield-enum-conversion -Wempty-body -Wignored-qualifiers -Woverloaded-virtual -Wpointer-arith -Wshadow-field-in-constructor-modified -Wsign-compare -Wtype-limits -Wunreachable-code -Wunreachable-code-return -Wwrite-strings -Wno-invalid-offsetof -Wclass-varargs -Wempty-init-stmt -Wfloat-overflow-conversion -Wfloat-zero-conversion -Wloop-analysis -Wc++2a-compat -Wcomma -Wimplicit-fallthrough -Wunused-function -Wunused-variable -Werror=non-literal-null-conversion -Wstring-conversion -Wtautological-overlap-compare -Wtautological-unsigned-enum-zero-compare -Wtautological-unsigned-zero-compare -Wno-error=tautological-type-limit-compare -Wno-inline-new-delete -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=backend-plugin -Wno-error=return-std-move -Wno-error=atomic-alignment -Wformat -Wformat-security -Wno-gnu-zero-variadic-macro-arguments -Wno-unknown-warning-option -fno-sized-deallocation -fno-aligned-new -fno-exceptions -fno-strict-aliasing -stdlib=libc++ -fno-rtti -ffunction-sections -fdata-sections -fno-exceptions -fno-math-errno -pthread -pipe -g -O3 -fno-omit-frame-pointer -funwind-tables -frtti -Wno-c++20-compat -Wno-comma -Wno-implicit-const-int-float-conversion -Wno-macro-redefined -Wno-microsoft-include -Wno-tautological-unsigned-enum-zero-compare -Wno-unreachable-code-loop-increment -Wno-unreachable-code-return  -MD -MP -MF .deps/collationweights.o.pp   /private/var/opt/generic-worker/tasks/task_160969589330515/checkouts/gecko/intl/icu/source/i18n/collationweights.cpp
[task 2021-01-04T15:30:18.705Z] 15:30:18     INFO -  config/external/icu/i18n/coptccal.o
[task 2021-01-04T15:30:18.711Z] 15:30:18     INFO -  /usr/bin/clang++ -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -std=gnu++17 -o compactdecimalformat.o -c  -fvisibility=hidden -fvisibility-inlines-hidden -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -ftrivial-auto-var-init=pattern -DDEBUG=1 -DU_I18N_IMPLEMENTATION -DU_USING_ICU_NAMESPACE=0 -DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1 -DU_HIDE_OBSOLETE_UTF_OLD_H=1 -DUCONFIG_NO_LEGACY_CONVERSION -DUCONFIG_NO_TRANSLITERATION -DUCONFIG_NO_REGULAR_EXPRESSIONS -DU_CHARSET_IS_UTF8 -DUNISTR_FROM_CHAR_EXPLICIT=explicit -DUNISTR_FROM_STRING_EXPLICIT=explicit -DU_ENABLE_DYLOAD=0 -DU_HAVE_NL_LANGINFO_CODESET=0 -DU_DEBUG=1 -I/private/var/opt/generic-worker/tasks/task_160969589330515/checkouts/gecko/config/external/icu/i18n -I/private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/config/external/icu/i18n -I/private/var/opt/generic-worker/tasks/task_160969589330515/checkouts/gecko/intl/icu/source/common -I/private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/dist/include -I/private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/dist/include/nspr -I/private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/dist/include/nss -fPIC -DMOZILLA_CLIENT -include /private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/mozilla-config.h -Qunused-arguments -Qunused-arguments -Wall -Wbitfield-enum-conversion -Wempty-body -Wignored-qualifiers -Woverloaded-virtual -Wpointer-arith -Wshadow-field-in-constructor-modified -Wsign-compare -Wtype-limits -Wunreachable-code -Wunreachable-code-return -Wwrite-strings -Wno-invalid-offsetof -Wclass-varargs -Wempty-init-stmt -Wfloat-overflow-conversion -Wfloat-zero-conversion -Wloop-analysis -Wc++2a-compat -Wcomma -Wimplicit-fallthrough -Wunused-function -Wunused-variable -Werror=non-literal-null-conversion -Wstring-conversion -Wtautological-overlap-compare -Wtautological-unsigned-enum-zero-compare -Wtautological-unsigned-zero-compare -Wno-error=tautological-type-limit-compare -Wno-inline-new-delete -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=backend-plugin -Wno-error=return-std-move -Wno-error=atomic-alignment -Wformat -Wformat-security -Wno-gnu-zero-variadic-macro-arguments -Wno-unknown-warning-option -fno-sized-deallocation -fno-aligned-new -fno-exceptions -fno-strict-aliasing -stdlib=libc++ -fno-rtti -ffunction-sections -fdata-sections -fno-exceptions -fno-math-errno -pthread -pipe -g -O3 -fno-omit-frame-pointer -funwind-tables -frtti -Wno-c++20-compat -Wno-comma -Wno-implicit-const-int-float-conversion -Wno-macro-redefined -Wno-microsoft-include -Wno-tautological-unsigned-enum-zero-compare -Wno-unreachable-code-loop-increment -Wno-unreachable-code-return  -MD -MP -MF .deps/compactdecimalformat.o.pp   /private/var/opt/generic-worker/tasks/task_160969589330515/checkouts/gecko/intl/icu/source/i18n/compactdecimalformat.cpp
[task 2021-01-04T15:30:19.306Z] 15:30:19     INFO -  config/external/icu/common/normalizer2impl.o
[task 2021-01-04T15:30:19.312Z] 15:30:19     INFO -  /usr/bin/clang++ -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -std=gnu++17 -o normalizer2.o -c  -fvisibility=hidden -fvisibility-inlines-hidden -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -ftrivial-auto-var-init=pattern -DDEBUG=1 -DU_COMMON_IMPLEMENTATION -DU_USING_ICU_NAMESPACE=0 -DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1 -DU_HIDE_OBSOLETE_UTF_OLD_H=1 -DUCONFIG_NO_LEGACY_CONVERSION -DUCONFIG_NO_TRANSLITERATION -DUCONFIG_NO_REGULAR_EXPRESSIONS -DU_CHARSET_IS_UTF8 -DUNISTR_FROM_CHAR_EXPLICIT=explicit -DUNISTR_FROM_STRING_EXPLICIT=explicit -DU_ENABLE_DYLOAD=0 -DU_HAVE_NL_LANGINFO_CODESET=0 -DU_DEBUG=1 -I/private/var/opt/generic-worker/tasks/task_160969589330515/checkouts/gecko/config/external/icu/common -I/private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/config/external/icu/common -I/private/var/opt/generic-worker/tasks/task_160969589330515/checkouts/gecko/intl/icu/source/i18n -I/private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/dist/include -I/private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/dist/include/nspr -I/private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/dist/include/nss -fPIC -DMOZILLA_CLIENT -include /private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/mozilla-config.h -Qunused-arguments -Qunused-arguments -Wall -Wbitfield-enum-conversion -Wempty-body -Wignored-qualifiers -Woverloaded-virtual -Wpointer-arith -Wshadow-field-in-constructor-modified -Wsign-compare -Wtype-limits -Wunreachable-code -Wunreachable-code-return -Wwrite-strings -Wno-invalid-offsetof -Wclass-varargs -Wempty-init-stmt -Wfloat-overflow-conversion -Wfloat-zero-conversion -Wloop-analysis -Wc++2a-compat -Wcomma -Wimplicit-fallthrough -Wunused-function -Wunused-variable -Werror=non-literal-null-conversion -Wstring-conversion -Wtautological-overlap-compare -Wtautological-unsigned-enum-zero-compare -Wtautological-unsigned-zero-compare -Wno-error=tautological-type-limit-compare -Wno-inline-new-delete -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=backend-plugin -Wno-error=return-std-move -Wno-error=atomic-alignment -Wformat -Wformat-security -Wno-gnu-zero-variadic-macro-arguments -Wno-unknown-warning-option -fno-sized-deallocation -fno-aligned-new -fno-exceptions -fno-strict-aliasing -stdlib=libc++ -fno-rtti -ffunction-sections -fdata-sections -fno-exceptions -fno-math-errno -pthread -pipe -g -O3 -fno-omit-frame-pointer -funwind-tables -Wno-deprecated-declarations -Wno-type-limits -Wno-unused-but-set-variable -Wno-unused-function -Wno-sign-compare -Wno-maybe-uninitialized -frtti -Wno-c++20-compat -Wno-comma -Wno-implicit-const-int-float-conversion -Wno-macro-redefined -Wno-microsoft-include -Wno-tautological-unsigned-enum-zero-compare -Wno-unreachable-code-loop-increment -Wno-unreachable-code-return  -MD -MP -MF .deps/normalizer2.o.pp   /private/var/opt/generic-worker/tasks/task_160969589330515/checkouts/gecko/intl/icu/source/common/normalizer2.cpp
[task 2021-01-04T15:30:19.594Z] 15:30:19     INFO -  config/external/icu/i18n/curramt.o
[task 2021-01-04T15:30:19.599Z] 15:30:19     INFO -  /usr/bin/clang++ -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -std=gnu++17 -o coptccal.o -c  -fvisibility=hidden -fvisibility-inlines-hidden -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -ftrivial-auto-var-init=pattern -DDEBUG=1 -DU_I18N_IMPLEMENTATION -DU_USING_ICU_NAMESPACE=0 -DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1 -DU_HIDE_OBSOLETE_UTF_OLD_H=1 -DUCONFIG_NO_LEGACY_CONVERSION -DUCONFIG_NO_TRANSLITERATION -DUCONFIG_NO_REGULAR_EXPRESSIONS -DU_CHARSET_IS_UTF8 -DUNISTR_FROM_CHAR_EXPLICIT=explicit -DUNISTR_FROM_STRING_EXPLICIT=explicit -DU_ENABLE_DYLOAD=0 -DU_HAVE_NL_LANGINFO_CODESET=0 -DU_DEBUG=1 -I/private/var/opt/generic-worker/tasks/task_160969589330515/checkouts/gecko/config/external/icu/i18n -I/private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/config/external/icu/i18n -I/private/var/opt/generic-worker/tasks/task_160969589330515/checkouts/gecko/intl/icu/source/common -I/private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/dist/include -I/private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/dist/include/nspr -I/private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/dist/include/nss -fPIC -DMOZILLA_CLIENT -include /private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/mozilla-config.h -Qunused-arguments -Qunused-arguments -Wall -Wbitfield-enum-conversion -Wempty-body -Wignored-qualifiers -Woverloaded-virtual -Wpointer-arith -Wshadow-field-in-constructor-modified -Wsign-compare -Wtype-limits -Wunreachable-code -Wunreachable-code-return -Wwrite-strings -Wno-invalid-offsetof -Wclass-varargs -Wempty-init-stmt -Wfloat-overflow-conversion -Wfloat-zero-conversion -Wloop-analysis -Wc++2a-compat -Wcomma -Wimplicit-fallthrough -Wunused-function -Wunused-variable -Werror=non-literal-null-conversion -Wstring-conversion -Wtautological-overlap-compare -Wtautological-unsigned-enum-zero-compare -Wtautological-unsigned-zero-compare -Wno-error=tautological-type-limit-compare -Wno-inline-new-delete -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=backend-plugin -Wno-error=return-std-move -Wno-error=atomic-alignment -Wformat -Wformat-security -Wno-gnu-zero-variadic-macro-arguments -Wno-unknown-warning-option -fno-sized-deallocation -fno-aligned-new -fno-exceptions -fno-strict-aliasing -stdlib=libc++ -fno-rtti -ffunction-sections -fdata-sections -fno-exceptions -fno-math-errno -pthread -pipe -g -O3 -fno-omit-frame-pointer -funwind-tables -frtti -Wno-c++20-compat -Wno-comma -Wno-implicit-const-int-float-conversion -Wno-macro-redefined -Wno-microsoft-include -Wno-tautological-unsigned-enum-zero-compare -Wno-unreachable-code-loop-increment -Wno-unreachable-code-return  -MD -MP -MF .deps/coptccal.o.pp   /private/var/opt/generic-worker/tasks/task_160969589330515/checkouts/gecko/intl/icu/source/i18n/coptccal.cpp
[task 2021-01-04T15:30:19.814Z] 15:30:19    ERROR -  /private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/dist/include/nsReadableUtils.h:456:20: error: loop variable 'item' is always a copy because the range of type 'const mozilla::EnumSet<unsigned long, unsigned long long>' does not return a reference [-Werror,-Wrange-loop-analysis]
[task 2021-01-04T15:30:19.814Z] 15:30:19     INFO -    for (const auto& item : aInputRange) {
[task 2021-01-04T15:30:19.814Z] 15:30:19     INFO -                     ^
[task 2021-01-04T15:30:19.815Z] 15:30:19     INFO -  /private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/dist/include/nsReadableUtils.h:484:3: note: in instantiation of function template specialization 'StringJoinAppend<char, mozilla::EnumSet<unsigned long, unsigned long long>, (lambda at /private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/dist/include/mozilla/dom/SyncedContextInlines.h:25:21)>' requested here
[task 2021-01-04T15:30:19.815Z] 15:30:19     INFO -    StringJoinAppend(res, aSeparator, aInputRange, std::forward<Func>(aFunc));
[task 2021-01-04T15:30:19.815Z] 15:30:19     INFO -    ^
[task 2021-01-04T15:30:19.816Z] 15:30:19     INFO -  /private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/dist/include/mozilla/dom/SyncedContextInlines.h:38:23: note: in instantiation of function template specialization 'mozilla::dom::syncedcontext::FormatValidationError<mozilla::dom::WindowContext>' requested here
[task 2021-01-04T15:30:19.816Z] 15:30:19     INFO -      nsCString error = FormatValidationError<Context>(
[task 2021-01-04T15:30:19.817Z] 15:30:19     INFO -          
[task 2021-01-04T15:30:19.817Z] 15:30:19     INFO -  /private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/dist/include/nsReadableUtils.h:456:8: note: use non-reference type 'unsigned long'
[task 2021-01-04T15:30:19.817Z] 15:30:19     INFO -    for (const auto& item : aInputRange) {
[task 2021-01-04T15:30:19.817Z] 15:30:19     INFO -         ^~~~~~~~~~~~~~~~~~
[task 2021-01-04T15:30:20.395Z] 15:30:20     INFO -  config/external/icu/i18n/currfmt.o
[task 2021-01-04T15:30:20.401Z] 15:30:20     INFO -  /usr/bin/clang++ -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -std=gnu++17 -o curramt.o -c  -fvisibility=hidden -fvisibility-inlines-hidden -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -ftrivial-auto-var-init=pattern -DDEBUG=1 -DU_I18N_IMPLEMENTATION -DU_USING_ICU_NAMESPACE=0 -DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1 -DU_HIDE_OBSOLETE_UTF_OLD_H=1 -DUCONFIG_NO_LEGACY_CONVERSION -DUCONFIG_NO_TRANSLITERATION -DUCONFIG_NO_REGULAR_EXPRESSIONS -DU_CHARSET_IS_UTF8 -DUNISTR_FROM_CHAR_EXPLICIT=explicit -DUNISTR_FROM_STRING_EXPLICIT=explicit -DU_ENABLE_DYLOAD=0 -DU_HAVE_NL_LANGINFO_CODESET=0 -DU_DEBUG=1 -I/private/var/opt/generic-worker/tasks/task_160969589330515/checkouts/gecko/config/external/icu/i18n -I/private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/config/external/icu/i18n -I/private/var/opt/generic-worker/tasks/task_160969589330515/checkouts/gecko/intl/icu/source/common -I/private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/dist/include -I/private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/dist/include/nspr -I/private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/dist/include/nss -fPIC -DMOZILLA_CLIENT -include /private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/mozilla-config.h -Qunused-arguments -Qunused-arguments -Wall -Wbitfield-enum-conversion -Wempty-body -Wignored-qualifiers -Woverloaded-virtual -Wpointer-arith -Wshadow-field-in-constructor-modified -Wsign-compare -Wtype-limits -Wunreachable-code -Wunreachable-code-return -Wwrite-strings -Wno-invalid-offsetof -Wclass-varargs -Wempty-init-stmt -Wfloat-overflow-conversion -Wfloat-zero-conversion -Wloop-analysis -Wc++2a-compat -Wcomma -Wimplicit-fallthrough -Wunused-function -Wunused-variable -Werror=non-literal-null-conversion -Wstring-conversion -Wtautological-overlap-compare -Wtautological-unsigned-enum-zero-compare -Wtautological-unsigned-zero-compare -Wno-error=tautological-type-limit-compare -Wno-inline-new-delete -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=backend-plugin -Wno-error=return-std-move -Wno-error=atomic-alignment -Wformat -Wformat-security -Wno-gnu-zero-variadic-macro-arguments -Wno-unknown-warning-option -fno-sized-deallocation -fno-aligned-new -fno-exceptions -fno-strict-aliasing -stdlib=libc++ -fno-rtti -ffunction-sections -fdata-sections -fno-exceptions -fno-math-errno -pthread -pipe -g -O3 -fno-omit-frame-pointer -funwind-tables -frtti -Wno-c++20-compat -Wno-comma -Wno-implicit-const-int-float-conversion -Wno-macro-redefined -Wno-microsoft-include -Wno-tautological-unsigned-enum-zero-compare -Wno-unreachable-code-loop-increment -Wno-unreachable-code-return  -MD -MP -MF .deps/curramt.o.pp   /private/var/opt/generic-worker/tasks/task_160969589330515/checkouts/gecko/intl/icu/source/i18n/curramt.cpp
[task 2021-01-04T15:30:20.685Z] 15:30:20     INFO -  config/external/icu/common/normlzr.o
[task 2021-01-04T15:30:20.690Z] 15:30:20     INFO -  /usr/bin/clang++ -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -std=gnu++17 -o normalizer2impl.o -c  -fvisibility=hidden -fvisibility-inlines-hidden -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -ftrivial-auto-var-init=pattern -DDEBUG=1 -DU_COMMON_IMPLEMENTATION -DU_USING_ICU_NAMESPACE=0 -DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1 -DU_HIDE_OBSOLETE_UTF_OLD_H=1 -DUCONFIG_NO_LEGACY_CONVERSION -DUCONFIG_NO_TRANSLITERATION -DUCONFIG_NO_REGULAR_EXPRESSIONS -DU_CHARSET_IS_UTF8 -DUNISTR_FROM_CHAR_EXPLICIT=explicit -DUNISTR_FROM_STRING_EXPLICIT=explicit -DU_ENABLE_DYLOAD=0 -DU_HAVE_NL_LANGINFO_CODESET=0 -DU_DEBUG=1 -I/private/var/opt/generic-worker/tasks/task_160969589330515/checkouts/gecko/config/external/icu/common -I/private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/config/external/icu/common -I/private/var/opt/generic-worker/tasks/task_160969589330515/checkouts/gecko/intl/icu/source/i18n -I/private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/dist/include -I/private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/dist/include/nspr -I/private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/dist/include/nss -fPIC -DMOZILLA_CLIENT -include /private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/mozilla-config.h -Qunused-arguments -Qunused-arguments -Wall -Wbitfield-enum-conversion -Wempty-body -Wignored-qualifiers -Woverloaded-virtual -Wpointer-arith -Wshadow-field-in-constructor-modified -Wsign-compare -Wtype-limits -Wunreachable-code -Wunreachable-code-return -Wwrite-strings -Wno-invalid-offsetof -Wclass-varargs -Wempty-init-stmt -Wfloat-overflow-conversion -Wfloat-zero-conversion -Wloop-analysis -Wc++2a-compat -Wcomma -Wimplicit-fallthrough -Wunused-function -Wunused-variable -Werror=non-literal-null-conversion -Wstring-conversion -Wtautological-overlap-compare -Wtautological-unsigned-enum-zero-compare -Wtautological-unsigned-zero-compare -Wno-error=tautological-type-limit-compare -Wno-inline-new-delete -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=backend-plugin -Wno-error=return-std-move -Wno-error=atomic-alignment -Wformat -Wformat-security -Wno-gnu-zero-variadic-macro-arguments -Wno-unknown-warning-option -fno-sized-deallocation -fno-aligned-new -fno-exceptions -fno-strict-aliasing -stdlib=libc++ -fno-rtti -ffunction-sections -fdata-sections -fno-exceptions -fno-math-errno -pthread -pipe -g -O3 -fno-omit-frame-pointer -funwind-tables -Wno-deprecated-declarations -Wno-type-limits -Wno-unused-but-set-variable -Wno-unused-function -Wno-sign-compare -Wno-maybe-uninitialized -frtti -Wno-c++20-compat -Wno-comma -Wno-implicit-const-int-float-conversion -Wno-macro-redefined -Wno-microsoft-include -Wno-tautological-unsigned-enum-zero-compare -Wno-unreachable-code-loop-increment -Wno-unreachable-code-return  -MD -MP -MF .deps/normalizer2impl.o.pp   /private/var/opt/generic-worker/tasks/task_160969589330515/checkouts/gecko/intl/icu/source/common/normalizer2impl.cpp
[task 2021-01-04T15:30:21.021Z] 15:30:21     INFO -  config/external/icu/i18n/currpinf.o
[task 2021-01-04T15:30:21.027Z] 15:30:21     INFO -  /usr/bin/clang++ -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -std=gnu++17 -o currfmt.o -c  -fvisibility=hidden -fvisibility-inlines-hidden -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -ftrivial-auto-var-init=pattern -DDEBUG=1 -DU_I18N_IMPLEMENTATION -DU_USING_ICU_NAMESPACE=0 -DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1 -DU_HIDE_OBSOLETE_UTF_OLD_H=1 -DUCONFIG_NO_LEGACY_CONVERSION -DUCONFIG_NO_TRANSLITERATION -DUCONFIG_NO_REGULAR_EXPRESSIONS -DU_CHARSET_IS_UTF8 -DUNISTR_FROM_CHAR_EXPLICIT=explicit -DUNISTR_FROM_STRING_EXPLICIT=explicit -DU_ENABLE_DYLOAD=0 -DU_HAVE_NL_LANGINFO_CODESET=0 -DU_DEBUG=1 -I/private/var/opt/generic-worker/tasks/task_160969589330515/checkouts/gecko/config/external/icu/i18n -I/private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/config/external/icu/i18n -I/private/var/opt/generic-worker/tasks/task_160969589330515/checkouts/gecko/intl/icu/source/common -I/private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/dist/include -I/private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/dist/include/nspr -I/private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/dist/include/nss -fPIC -DMOZILLA_CLIENT -include /private/var/opt/generic-worker/tasks/task_160969589330515/build/obj-build/mozilla-config.h -Qunused-arguments -Qunused-arguments -Wall -Wbitfield-enum-conversion -Wempty-body -Wignored-qualifiers -Woverloaded-virtual -Wpointer-arith -Wshadow-field-in-constructor-modified -Wsign-compare -Wtype-limits -Wunreachable-code -Wunreachable-code-return -Wwrite-strings -Wno-invalid-offsetof -Wclass-varargs -Wempty-init-stmt -Wfloat-overflow-conversion -Wfloat-zero-conversion -Wloop-analysis -Wc++2a-compat -Wcomma -Wimplicit-fallthrough -Wunused-function -Wunused-variable -Werror=non-literal-null-conversion -Wstring-conversion -Wtautological-overlap-compare -Wtautological-unsigned-enum-zero-compare -Wtautological-unsigned-zero-compare -Wno-error=tautological-type-limit-compare -Wno-inline-new-delete -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=backend-plugin -Wno-error=return-std-move -Wno-error=atomic-alignment -Wformat -Wformat-security -Wno-gnu-zero-variadic-macro-arguments -Wno-unknown-warning-option -fno-sized-deallocation -fno-aligned-new -fno-exceptions -fno-strict-aliasing -stdlib=libc++ -fno-rtti -ffunction-sections -fdata-sections -fno-exceptions -fno-math-errno -pthread -pipe -g -O3 -fno-omit-frame-pointer -funwind-tables -frtti -Wno-c++20-compat -Wno-comma -Wno-implicit-const-int-float-conversion -Wno-macro-redefined -Wno-microsoft-include -Wno-tautological-unsigned-enum-zero-compare -Wno-unreachable-code-loop-increment -Wno-unreachable-code-return  -MD -MP -MF .deps/currfmt.o.pp   /private/var/opt/generic-worker/tasks/task_160969589330515/checkouts/gecko/intl/icu/source/i18n/currfmt.cpp
[task 2021-01-04T15:30:21.077Z] 15:30:21     INFO -  2 errors generated.
[task 2021-01-04T15:30:21.152Z] 15:30:21    ERROR -  make[4]: *** [Unified_cpp_docshell_base0.o] Error 1
[task 2021-01-04T15:30:21.152Z] 15:30:21    ERROR -  make[3]: *** [docshell/base/target-objects] Error 2
[task 2021-01-04T15:30:21.153Z] 15:30:21     INFO -  make[3]: *** Waiting for unfinished jobs....
[task 2021-01-04T15:30:21.154Z] 15:30:21     INFO -  dom/base/nsGlobalWindowOuter.o
Flags: needinfo?(mhentges)

Hmm, surprised that wasn't resolved the first go around.
I've whittled down the reproduce to a godbolt here.

Flags: needinfo?(mhentges)

FWIW, we have another option: the reason why this failed in your push is because -Wrange-loop-analysis changed from Clang 9 to Clang 10. In Clang 10, it now refers to two sub-flags (-Wrange-loop-bind-reference and -Wrange-loop-construct), both of which don't trigger that same error.

My quote above was incorrect! It turns out that I was hoodwinked by a clang >= 10 bug:

This is what allowed Simon's patch to be green in try (clang 11), while failing in base-toolchain (clang 5).

However, since the range-loop-analysis behaviour hasn't changed between versions (other than for that bug^), Simon's earlier concerns still hold, and range-loop-analysis should be disabled, always.

Attachment #9193992 - Attachment description: Bug 1683213: Don't warn on range-loop-analysis for clang < 10 → Bug 1683213: Don't warn on range-loop-analysis
Pushed by mhentges@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/eb5d5af5144f
Don't warn on range-loop-analysis r=sheehan,sg,firefox-build-system-reviewers,andi,glandium
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
See Also: → 1718408
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: