Bug 212006 - [JSC] Silence unused-but-set-parameter warnings for older compilers
Summary: [JSC] Silence unused-but-set-parameter warnings for older compilers
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Lauro Moura
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-05-17 19:17 PDT by Lauro Moura
Modified: 2020-05-18 06:19 PDT (History)
8 users (show)

See Also:


Attachments
Patch (1.56 KB, patch)
2020-05-17 19:21 PDT, Lauro Moura
no flags Details | Formatted Diff | Diff
Updated patch with UNUSED_PARAM (1.58 KB, patch)
2020-05-17 21:05 PDT, Lauro Moura
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Lauro Moura 2020-05-17 19:17:48 PDT
After r261754, older compilers (GCC up to 9.x) complain about the `sources` parameter being set but not used when NumberOfRegisters is zero. The same may happen to destinations when both NumberOfRegisters is zero and ASSERT_ENABLE is false.

Example:

In file included from ../../Source/JavaScriptCore/jit/Snippet.h:31, 
                 from ../../Source/JavaScriptCore/domjit/DOMJITCallDOMGetterSnippet.h:31,
                 from ../../Source/JavaScriptCore/domjit/DOMJITGetterSetter.h:28,
                 from ../../Source/JavaScriptCore/runtime/Lookup.h:26,
                 from ../../Source/JavaScriptCore/runtime/JSObjectInlines.h:32,
                 from ../../Source/JavaScriptCore/runtime/JSCInlines.h:48,
                 from ../../Source/JavaScriptCore/bytecode/ObjectPropertyConditionSet.cpp:29,
                 from DerivedSources/JavaScriptCore/unified-sources/UnifiedSource-f0a787a9-9.cpp:3:
../../Source/JavaScriptCore/jit/CCallHelpers.h: In instantiation of ‘void JSC::CCallHelpers::setupStubArgs(std::array<RegType, NumberOfRegisters>, std::array<RegType, NumberOfRegisters>) [with unsigned int NumberOfRegisters = 0; RegType = JSC::X86Registers::RegisterID]’:
../../Source/JavaScriptCore/jit/CCallHelpers.h:645:9:   required from ‘void JSC::CCallHelpers::setupArgumentsImpl(JSC::CCallHelpers::ArgCollection<numGPRArgs, numGPRSources, numFPRArgs, numFPRSources, numCrossSources, extraGPRArgs, extraPoke>) [with OperationType = void(JSC::VM*); unsigned int numGPRArgs = 1; unsigned int numGPRSources = 0; unsigned int numFPRArgs = 0; unsigned int numFPRSources = 0; unsigned int numCrossSources = 0; unsigned int extraGPRArgs = 0; unsigned int extraPoke = 0]’
../../Source/JavaScriptCore/jit/CCallHelpers.h:585:13:   required from ‘std::enable_if_t<(std::is_base_of<JSC::AbstractMacroAssembler<JSC::X86Assembler>::TrustedImm, Arg>::value || std::is_convertible<Arg, JSC::AbstractMacroAssembler<JSC::X86Assembler>::TrustedImm>::value)> JSC::CCallHelpers::setupArgumentsImpl(JSC::CCallHelpers::ArgCollection<numGPRArgs, numGPRSources, numFPRArgs, numFPRSources, numCrossSources, extraGPRArgs, extraPoke>, Arg, Args ...) [with OperationType = void(JSC::VM*); unsigned int numGPRArgs = 0; unsigned int numGPRSources = 0; unsigned int numFPRArgs = 0; unsigned int numFPRSources = 0; unsigned int numCrossSources = 0; unsigned int extraGPRArgs = 0; unsigned int extraPoke = 0; Arg = JSC::AbstractMacroAssembler<JSC::X86Assembler>::TrustedImmPtr; Args = {}; std::enable_if_t<(std::is_base_of<JSC::AbstractMacroAssembler<JSC::X86Assembler>::TrustedImm, Arg>::value || std::is_convertible<Arg, JSC::AbstractMacroAssembler<JSC::X86Assembler>::TrustedImm>::value)> = void]’
../../Source/JavaScriptCore/jit/CCallHelpers.h:675:9:   required from ‘std::enable_if_t<(! std::is_same<typename WTF::FunctionTraits<T>::ArgumentType<0>, JSC::CallFrame*>::value)> JSC::CCallHelpers::setupArguments(Args ...) [with OperationType = void(JSC::VM*); Args = {JSC::AbstractMacroAssembler<JSC::X86Assembler>::TrustedImmPtr}; std::enable_if_t<(! std::is_same<typename WTF::FunctionTraits<T>::ArgumentType<0>, JSC::CallFrame*>::value)> = void]’
../../Source/JavaScriptCore/bytecode/PolymorphicAccess.cpp:215:106:   required from here
../../Source/JavaScriptCore/jit/CCallHelpers.h:90:130: warning: parameter ‘sources’ set but not used [-Wunused-but-set-parameter]
   90 |     ALWAYS_INLINE void setupStubArgs(std::array<RegType, NumberOfRegisters> destinations, std::array<RegType, NumberOfRegisters> sources)
      |                                                                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
Comment 1 Lauro Moura 2020-05-17 19:21:36 PDT
Created attachment 399614 [details]
Patch
Comment 2 Mark Lam 2020-05-17 20:50:19 PDT
Comment on attachment 399614 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=399614&action=review

> Source/JavaScriptCore/jit/CCallHelpers.h:111
> +            // Silence some older compilers (GCC up to 9.X) about unused but set parameters.
> +            (void)sources;
> +            (void)destinations;

We have standard idiom for this: see uses of UNUSED_PARAM in the code.
Comment 3 Lauro Moura 2020-05-17 21:05:09 PDT
Created attachment 399619 [details]
Updated patch with UNUSED_PARAM
Comment 4 EWS 2020-05-17 22:15:10 PDT
Committed r261797: <https://trac.webkit.org/changeset/261797>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 399619 [details].
Comment 5 Radar WebKit Bug Importer 2020-05-17 22:16:18 PDT
<rdar://problem/63327291>
Comment 6 Michael Catanzaro 2020-05-18 06:19:16 PDT
Thanks for keeping the build clean. :)