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

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.4.0-RC1, 1.4.0
    • Component/s: None
    • Labels:
      None

      Description

      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/

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: