Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-45256

Generator generates wrong code for integer value ( v8nodefilter.cpp )

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • P3: Somewhat important
    • None
    • 5.5.0 Alpha
    • WebEngine
    • None
    • GCC 5 on Fedora Rawhide

    Description

      gen/blink/bindings/core/v8/V8NodeFilter.cpp:93:5: error: narrowing conversion of ‘4294967295u’ from ‘unsigned int’ to ‘int’ inside { }
      
          static const V8DOMConfiguration::ConstantConfiguration V8NodeFilterConstants[] = {
              {"FILTER_ACCEPT", 1, 0, 0, V8DOMConfiguration::ConstantTypeShort},
              {"FILTER_REJECT", 2, 0, 0, V8DOMConfiguration::ConstantTypeShort},
              {"FILTER_SKIP", 3, 0, 0, V8DOMConfiguration::ConstantTypeShort},
              {"SHOW_ALL", 0xFFFFFFFF, 0, 0, V8DOMConfiguration::ConstantTypeUnsignedLong},
              {"SHOW_ELEMENT", 0x00000001, 0, 0, V8DOMConfiguration::ConstantTypeUnsignedLong},
              {"SHOW_ATTRIBUTE", 0x00000002, 0, 0, V8DOMConfiguration::ConstantTypeUnsignedLong},
              {"SHOW_TEXT", 0x00000004, 0, 0, V8DOMConfiguration::ConstantTypeUnsignedLong},
              {"SHOW_CDATA_SECTION", 0x00000008, 0, 0, V8DOMConfiguration::ConstantTypeUnsignedLong},
              {"SHOW_ENTITY_REFERENCE", 0x00000010, 0, 0, V8DOMConfiguration::ConstantTypeUnsignedLong},
              {"SHOW_ENTITY", 0x00000020, 0, 0, V8DOMConfiguration::ConstantTypeUnsignedLong},
              {"SHOW_PROCESSING_INSTRUCTION", 0x00000040, 0, 0, V8DOMConfiguration::ConstantTypeUnsignedLong},
              {"SHOW_COMMENT", 0x00000080, 0, 0, V8DOMConfiguration::ConstantTypeUnsignedLong},
              {"SHOW_DOCUMENT", 0x00000100, 0, 0, V8DOMConfiguration::ConstantTypeUnsignedLong},
              {"SHOW_DOCUMENT_TYPE", 0x00000200, 0, 0, V8DOMConfiguration::ConstantTypeUnsignedLong},
              {"SHOW_DOCUMENT_FRAGMENT", 0x00000400, 0, 0, V8DOMConfiguration::ConstantTypeUnsignedLong},
              {"SHOW_NOTATION", 0x00000800, 0, 0, V8DOMConfiguration::ConstantTypeUnsignedLong},
          };
      

      IRC log:

      <thiago> 0xFFFFFFFF is the problem
      <thiago> that's not an int, it's an unsigned
      <thiago> it's a bug in the generator, please report it
      
      <thiago> struct S { const char *name; int value; }; S s =  {"SHOW_ALL", 0xFFFFFFFF };
      
      <thiago> GCC 4.9: warning: narrowing conversion of ‘4294967295u’ from ‘unsigned int’ to ‘int’ inside { } [-Wnarrowing]
      
      <thiago> ICC 15: nothing
      
      <thiago> GCC 5: error: narrowing conversion of ‘4294967295u’ from ‘unsigned int’ to ‘int’ inside { }
      
      <thiago> Clang 3.6: error: constant expression evaluates to 4294967295 which cannot be narrowed to type 'int' [-Wc++11-narrowing]
      

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              qt_webengine_team Qt WebEngine Team
              usta Ömer Fadıl USTA
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes