Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-4237

Incompatible pointer type warnings in atomics

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 1.21.0
    • Affects Version/s: None
    • Component/s: None
    • None

      RHEL 7.0 with GCC 4.8.5 produces warnings for incompatible pointer types.

      Example 1

      /data/mci/0679d561d3a78b572969638933bfea70/mongoc/src/libbson/src/bson/bson-atomic.c:28:4: warning: passing argument 1 of 'bson_atomic_int32_fetch_add' from incompatible pointer type [enabled by default]
          return n + bson_atomic_int32_fetch_add (p, n, bson_memory_order_seq_cst);
          ^
      In file included from /data/mci/0679d561d3a78b572969638933bfea70/mongoc/src/libbson/src/bson/bson-atomic.c:18:0:
      /data/mci/0679d561d3a78b572969638933bfea70/mongoc/src/libbson/src/bson/bson-atomic.h:175:28: note: expected 'volatile long int *' but argument is of type 'volatile int32_t *'
          static BSON_INLINE Type bson_atomic_##NamePart##_fetch_add (               \
                                  ^
      /data/mci/0679d561d3a78b572969638933bfea70/mongoc/src/libbson/src/bson/bson-atomic.h:350:1: note: in expansion of macro 'DECL_ATOMIC_INTEGRAL'
       DECL_ATOMIC_INTEGRAL (int32, long, )
       ^
      

      Example 2

      In file included from /data/mci/0679d561d3a78b572969638933bfea70/mongoc/src/libbson/src/bson/bson-atomic.c:18:0:
      /data/mci/0679d561d3a78b572969638933bfea70/mongoc/src/libbson/src/bson/bson-atomic.h:298:28: note: expected 'volatile char *' but argument is of type 'int8_t *'
          static BSON_INLINE Type bson_atomic_##NamePart##_compare_exchange_weak (   \
                                  ^
      /data/mci/0679d561d3a78b572969638933bfea70/mongoc/src/libbson/src/bson/bson-atomic.h:347:1: note: in expansion of macro 'DECL_ATOMIC_INTEGRAL'
       DECL_ATOMIC_INTEGRAL (int8, char, 8);
       ^
      

      This impacts consumers building with -Werror.

            Assignee:
            ezra.chung@mongodb.com Ezra Chung
            Reporter:
            kevin.albertson@mongodb.com Kevin Albertson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: