<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>204870</bug_id>
          
          <creation_ts>2019-12-04 19:47:34 -0800</creation_ts>
          <short_desc>[MSVC] WebResourceLoadStatisticsStore.h is reporting warning C4804: &apos;/&apos;: unsafe use of type &apos;bool&apos; in operation</short_desc>
          <delta_ts>2019-12-05 10:30:20 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKit2</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=204873</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Fujii Hironori">fujii</reporter>
          <assigned_to name="Kate Cheney">katherine_cheney</assigned_to>
          <cc>commit-queue</cc>
    
    <cc>darin</cc>
    
    <cc>katherine_cheney</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1595677</commentid>
    <comment_count>0</comment_count>
    <who name="Fujii Hironori">fujii</who>
    <bug_when>2019-12-04 19:47:34 -0800</bug_when>
    <thetext>[MSVC] WebResourceLoadStatisticsStore.h is reporting warning C4804: &apos;/&apos;: unsafe use of type &apos;bool&apos; in operation

Since r253118 (Bug 203432)
https://build.webkit.org/builders/WinCairo%2064-bit%20WKL%20Release%20%28Build%29/builds/13884

[18/43] Building CXX object Source\WebKit\CMakeFiles\WebKit.dir\__\__\WebKit\DerivedSources\NetworkProcessMessageReceiver.cpp.obj
C:\WebKit-BuildWorker\wincairo-wkl-release\build\WebKitBuild\Release\WTF\Headers\wtf/text/IntegerToStringConversion.h(104): warning C4804: &apos;/=&apos;: unsafe use of type &apos;bool&apos; in operation
C:\WebKit-BuildWorker\wincairo-wkl-release\build\WebKitBuild\Release\WTF\Headers\wtf/text/IntegerToStringConversion.h(124): note: see reference to function template instantiation &apos;unsigned int WTF::lengthOfNumberAsStringImpl&lt;UnsignedIntegerType,WTF::PositiveNumber&gt;(UnsignedIntegerType)&apos; being compiled
        with
        [
            UnsignedIntegerType=bool
        ]
C:\WebKit-BuildWorker\wincairo-wkl-release\build\WebKitBuild\Release\WTF\Headers\wtf/text/StringConcatenateNumbers.h(58): note: see reference to function template instantiation &apos;unsigned int WTF::lengthOfNumberAsStringUnsigned&lt;UnsignedInt&gt;(UnsignedIntegerType)&apos; being compiled
        with
        [
            UnsignedInt=bool,
            UnsignedIntegerType=bool
        ]
C:\WebKit-BuildWorker\wincairo-wkl-release\build\WebKitBuild\Release\WTF\Headers\wtf/text/StringConcatenateNumbers.h(58): note: while compiling class template member function &apos;unsigned int WTF::StringTypeAdapter&lt;bool,void&gt;::length(void) const&apos;
C:\WebKit-BuildWorker\wincairo-wkl-release\build\WebKitBuild\Release\WTF\Headers\wtf/text/StringConcatenate.h(319): note: see reference to function template instantiation &apos;unsigned int WTF::StringTypeAdapter&lt;bool,void&gt;::length(void) const&apos; being compiled
C:\WebKit-BuildWorker\wincairo-wkl-release\build\WebKitBuild\Release\WTF\Headers\wtf/text/StringConcatenate.h(348): note: see reference to class template instantiation &apos;WTF::StringTypeAdapter&lt;bool,void&gt;&apos; being compiled
C:\WebKit-BuildWorker\wincairo-wkl-release\build\WebKitBuild\Release\WTF\Headers\wtf/text/StringConcatenate.h(354): note: see reference to function template instantiation &apos;WTF::String WTF::tryMakeString&lt;const char*,WTF::String,const char*,bool&gt;(const char *,WTF::String,const char *,bool)&apos; being compiled
C:\WebKit-BuildWorker\wincairo-wkl-release\build\Source\WebKit\NetworkProcess\Classifier\WebResourceLoadStatisticsStore.h(87): note: see reference to function template instantiation &apos;WTF::String WTF::makeString&lt;const char*,WTF::String,const char*,bool&gt;(const char *,WTF::String,const char *,bool)&apos; being compiled
C:\WebKit-BuildWorker\wincairo-wkl-release\build\WebKitBuild\Release\WTF\Headers\wtf/text/IntegerToStringConversion.h(104): warning C4804: &apos;/&apos;: unsafe use of type &apos;bool&apos; in operation
C:\WebKit-BuildWorker\wincairo-wkl-release\build\WebKitBuild\Release\WTF\Headers\wtf/text/IntegerToStringConversion.h(72): warning C4804: &apos;%&apos;: unsafe use of type &apos;bool&apos; in operation
C:\WebKit-BuildWorker\wincairo-wkl-release\build\WebKitBuild\Release\WTF\Headers\wtf/text/IntegerToStringConversion.h(94): note: see reference to function template instantiation &apos;void WTF::writeNumberToBufferImpl&lt;CharacterType,UnsignedIntegerType,WTF::PositiveNumber&gt;(UnsignedIntegerType,CharacterType *)&apos; being compiled
        with
        [
            CharacterType=LChar,
            UnsignedIntegerType=bool
        ]
C:\WebKit-BuildWorker\wincairo-wkl-release\build\WebKitBuild\Release\WTF\Headers\wtf/text/StringConcatenateNumbers.h(60): note: see reference to function template instantiation &apos;void WTF::writeNumberToBufferUnsigned&lt;CharacterType,UnsignedInt&gt;(UnsignedIntegerType,CharacterType *)&apos; being compiled
        with
        [
            CharacterType=LChar,
            UnsignedInt=bool,
            UnsignedIntegerType=bool
        ]
C:\WebKit-BuildWorker\wincairo-wkl-release\build\WebKitBuild\Release\WTF\Headers\wtf/text/StringConcatenate.h(305): note: see reference to function template instantiation &apos;void WTF::StringTypeAdapter&lt;bool,void&gt;::writeTo&lt;ResultType&gt;(CharacterType *) const&apos; being compiled
        with
        [
            ResultType=LChar,
            CharacterType=LChar
        ]
C:\WebKit-BuildWorker\wincairo-wkl-release\build\WebKitBuild\Release\WTF\Headers\wtf/text/StringConcatenate.h(305): note: see reference to function template instantiation &apos;void WTF::StringTypeAdapter&lt;bool,void&gt;::writeTo&lt;ResultType&gt;(CharacterType *) const&apos; being compiled
        with
        [
            ResultType=LChar,
            CharacterType=LChar
        ]
C:\WebKit-BuildWorker\wincairo-wkl-release\build\WebKitBuild\Release\WTF\Headers\wtf/text/StringConcatenate.h(310): note: see reference to function template instantiation &apos;void WTF::stringTypeAdapterAccumulator&lt;ResultType,WTF::StringTypeAdapter&lt;bool,void&gt;&gt;(ResultType *,Adapter)&apos; being compiled
        with
        [
            ResultType=LChar,
            Adapter=WTF::StringTypeAdapter&lt;bool,void&gt;
        ]
C:\WebKit-BuildWorker\wincairo-wkl-release\build\WebKitBuild\Release\WTF\Headers\wtf/text/StringConcatenate.h(310): note: see reference to function template instantiation &apos;void WTF::stringTypeAdapterAccumulator&lt;ResultType,WTF::StringTypeAdapter&lt;const char*,void&gt;,WTF::StringTypeAdapter&lt;bool,void&gt;&gt;(ResultType *,Adapter,WTF::StringTypeAdapter&lt;bool,void&gt;)&apos; being compiled
        with
        [
            ResultType=LChar,
            Adapter=WTF::StringTypeAdapter&lt;const char*,void&gt;
        ]
C:\WebKit-BuildWorker\wincairo-wkl-release\build\WebKitBuild\Release\WTF\Headers\wtf/text/StringConcatenate.h(310): note: see reference to function template instantiation &apos;void WTF::stringTypeAdapterAccumulator&lt;ResultType,WTF::StringTypeAdapter&lt;WTF::String,void&gt;,WTF::StringTypeAdapter&lt;const char*,void&gt;,WTF::StringTypeAdapter&lt;bool,void&gt;&gt;(ResultType *,Adapter,WTF::StringTypeAdapter&lt;const char*,void&gt;,WTF::StringTypeAdapter&lt;bool,void&gt;)&apos; being compiled
        with
        [
            ResultType=LChar,
            Adapter=WTF::StringTypeAdapter&lt;WTF::String,void&gt;
        ]
C:\WebKit-BuildWorker\wincairo-wkl-release\build\WebKitBuild\Release\WTF\Headers\wtf/text/StringConcatenate.h(317): note: see reference to function template instantiation &apos;void WTF::stringTypeAdapterAccumulator&lt;LChar,StringTypeAdapter,WTF::StringTypeAdapter&lt;WTF::String,void&gt;,WTF::StringTypeAdapter&lt;const char*,void&gt;,WTF::StringTypeAdapter&lt;bool,void&gt;&gt;(ResultType *,Adapter,WTF::StringTypeAdapter&lt;WTF::String,void&gt;,WTF::StringTypeAdapter&lt;const char*,void&gt;,WTF::StringTypeAdapter&lt;bool,void&gt;)&apos; being compiled
        with
        [
            StringTypeAdapter=WTF::StringTypeAdapter&lt;const char*,void&gt;,
            ResultType=LChar,
            Adapter=WTF::StringTypeAdapter&lt;const char*,void&gt;
        ]
C:\WebKit-BuildWorker\wincairo-wkl-release\build\WebKitBuild\Release\WTF\Headers\wtf/text/StringConcatenate.h(348): note: see reference to function template instantiation &apos;WTF::String WTF::tryMakeStringFromAdapters&lt;WTF::StringTypeAdapter&lt;const char*,void&gt;,WTF::StringTypeAdapter&lt;WTF::String,void&gt;,WTF::StringTypeAdapter&lt;const char*,void&gt;,WTF::StringTypeAdapter&lt;bool,void&gt;&gt;(StringTypeAdapter,WTF::StringTypeAdapter&lt;WTF::String,void&gt;,WTF::StringTypeAdapter&lt;const char*,void&gt;,WTF::StringTypeAdapter&lt;bool,void&gt;)&apos; being compiled
        with
        [
            StringTypeAdapter=WTF::StringTypeAdapter&lt;const char*,void&gt;
        ]
C:\WebKit-BuildWorker\wincairo-wkl-release\build\WebKitBuild\Release\WTF\Headers\wtf/text/IntegerToStringConversion.h(73): warning C4804: &apos;/=&apos;: unsafe use of type &apos;bool&apos; in operation
C:\WebKit-BuildWorker\wincairo-wkl-release\build\WebKitBuild\Release\WTF\Headers\wtf/text/IntegerToStringConversion.h(73): warning C4804: &apos;/&apos;: unsafe use of type &apos;bool&apos; in operation</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1595688</commentid>
    <comment_count>1</comment_count>
    <who name="Fujii Hironori">fujii</who>
    <bug_when>2019-12-04 20:14:25 -0800</bug_when>
    <thetext>This can be solved by

1. storageAccessGranted ? &quot;0&quot; : &quot;1&quot;
2. unsigned(storageAccessGranted)
3. Change makeString to explitly accept bool type

#3 seems better for MSVC.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1595714</commentid>
    <comment_count>2</comment_count>
    <who name="Fujii Hironori">fujii</who>
    <bug_when>2019-12-04 21:19:26 -0800</bug_when>
    <thetext>GCC and Clang doesn&apos;t report warnings for bool / 10.
https://godbolt.org/z/RjKz-m</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1595718</commentid>
    <comment_count>3</comment_count>
    <who name="Fujii Hironori">fujii</who>
    <bug_when>2019-12-04 21:57:33 -0800</bug_when>
    <thetext>(In reply to Fujii Hironori from comment #1)
&gt; #3 seems better for MSVC.

Filed: Bug 204873 – [MSVC] writeNumberToBufferUnsigned is unsafe for bool type</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1595796</commentid>
    <comment_count>4</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2019-12-05 07:33:48 -0800</bug_when>
    <thetext>I suggest doing (1) for now. Or could do this more efficient version:

    storageAccessGranted ? &apos;0&apos; : &apos;1&apos;

Then I suggest we consider either adding support for bool or disabling use of bool in makeString. But I don’t think a bool should necessarily serialize as &quot;0&quot;/&quot;1&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1595816</commentid>
    <comment_count>5</comment_count>
      <attachid>384906</attachid>
    <who name="Kate Cheney">katherine_cheney</who>
    <bug_when>2019-12-05 08:47:32 -0800</bug_when>
    <thetext>Created attachment 384906
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1595872</commentid>
    <comment_count>6</comment_count>
      <attachid>384906</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2019-12-05 10:29:22 -0800</bug_when>
    <thetext>Comment on attachment 384906
Patch

Clearing flags on attachment: 384906

Committed r253155: &lt;https://trac.webkit.org/changeset/253155&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1595873</commentid>
    <comment_count>7</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2019-12-05 10:29:24 -0800</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1595874</commentid>
    <comment_count>8</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2019-12-05 10:30:20 -0800</bug_when>
    <thetext>&lt;rdar://problem/57668408&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>384906</attachid>
            <date>2019-12-05 08:47:32 -0800</date>
            <delta_ts>2019-12-05 10:29:22 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>bug-204870-20191205084732.patch</filename>
            <type>text/plain</type>
            <size>1791</size>
            <attacher name="Kate Cheney">katherine_cheney</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjUzMTUwCmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViS2l0L0No
YW5nZUxvZyBiL1NvdXJjZS9XZWJLaXQvQ2hhbmdlTG9nCmluZGV4IDJiNzVhZjZkMjE0MDU3NDM3
YzQ3YTdjNmNmMWEwYzgwMWRmYjY5NTguLmQzYTc3ZDk4ZmZiNWZlY2NmOGUyNGZlMzQwMTNjM2M4
OTgwZDJkMTMgMTAwNjQ0Ci0tLSBhL1NvdXJjZS9XZWJLaXQvQ2hhbmdlTG9nCisrKyBiL1NvdXJj
ZS9XZWJLaXQvQ2hhbmdlTG9nCkBAIC0xLDMgKzEsMTYgQEAKKzIwMTktMTItMDUgIEthdGUgQ2hl
bmV5ICA8a2F0aGVyaW5lX2NoZW5leUBhcHBsZS5jb20+CisKKyAgICAgICAgW01TVkNdIFdlYlJl
c291cmNlTG9hZFN0YXRpc3RpY3NTdG9yZS5oIGlzIHJlcG9ydGluZyB3YXJuaW5nIEM0ODA0OiAn
Lyc6IHVuc2FmZSB1c2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