Uploaded image for project: 'PHP Driver: Extension'
  1. PHP Driver: Extension
  2. PHPC-1084

Upgrade switch/case fallthrough comments to use GCC 7's new attribute

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.4.0-RC1, 1.4.0
    • Affects Version/s: None
    • Component/s: None
    • None

      GCC 7 adds a new flag to -Wextra: -Wimplicit-fallthrough, which warns when there is no break; statement at the end each case section. This currently makes the driver not compile with:

      /home/derick/dev/php/derickr-mongo-php-driver/src/bson-encode.c: In function ‘php_phongo_bson_append’:
      /home/derick/dev/php/derickr-mongo-php-driver/src/bson-encode.c:346:7: error: this statement may fall through [-Werror=implicit-fallthrough=]
          if (php_phongo_is_array_or_document(entry TSRMLS_CC) == IS_ARRAY) {
             ^
      /home/derick/dev/php/derickr-mongo-php-driver/src/bson-encode.c:369:3: note: here
         case IS_OBJECT: {
         ^~~~
      cc1: all warnings being treated as errors
      

      It needs to use the new attribute as is described at https://developers.redhat.com/blog/2017/03/10/wimplicit-fallthrough-in-gcc-7/

            Assignee:
            derick Derick Rethans
            Reporter:
            derick Derick Rethans
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: