Project

General

Profile

Bug #4908

Errors compiling with -std=c++14

Added by pespin 2 months ago. Updated about 1 month ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
12/15/2020
Due date:
% Done:

0%

Spec Reference:

Description

diff --git a/configure.ac b/configure.ac
index 2e99a15..ffdfddc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -9,7 +9,7 @@ AC_CONFIG_AUX_DIR([.])
 AM_INIT_AUTOMAKE([dist-bzip2])
 AC_CONFIG_TESTDIR(tests)

-CXXFLAGS="$CXXFLAGS -std=gnu++03" 
+CXXFLAGS="$CXXFLAGS -std=c++14" 
 CFLAGS="$CFLAGS -std=gnu89" 

 dnl kernel style compile messages

Same with -std=c++11. -std=gnu++11 and 14 work fine though.

In file included from ./gsm_timer.h:31:0,
                 from ./gprs_rlcmac.h:27,
                 from gprs_bssgp_pcu.cpp:21:
gprs_bssgp_pcu.cpp: In function 'int bssgp_prim_cb(osmo_prim_hdr*, void*)':
gprs_bssgp_pcu.cpp:539:7: error: cannot convert 'osmo_prim_hdr' to 'const int' in initialization
  bp = container_of(oph, struct osmo_bssgp_prim, oph);
       ^
gprs_bssgp_pcu.cpp:539:7: error: '__mptr' was not declared in this scope
  bp = container_of(oph, struct osmo_bssgp_prim, oph);
       ^
gprs_bssgp_pcu.cpp:539:7: error: void value not ignored as it ought to be
  bp = container_of(oph, struct osmo_bssgp_prim, oph);
       ^
gprs_bssgp_pcu.cpp: In function 'int gprs_ns_prim_cb(osmo_prim_hdr*, void*)':
gprs_bssgp_pcu.cpp:597:8: error: cannot convert 'osmo_prim_hdr' to 'const int' in initialization
  nsp = container_of(oph, struct osmo_gprs_ns2_prim, oph);
        ^
gprs_bssgp_pcu.cpp:597:8: error: '__mptr' was not declared in this scope
  nsp = container_of(oph, struct osmo_gprs_ns2_prim, oph);
        ^
gprs_bssgp_pcu.cpp:597:8: error: void value not ignored as it ought to be
  nsp = container_of(oph, struct osmo_gprs_ns2_prim, oph);
        ^

History

#1 Updated by pespin 2 months ago

Using docker-playground.git/osmo-pcu-master/DOckerfile, which uses debian stretch image.

#2 Updated by pespin about 1 month ago

It seems typeof() is a GNU extension and not available in standard C++. In standard C++ however, there seems to exist "decltype" instead.

Related discussion:
https://stackoverflow.com/questions/1986418/typeid-versus-typeof-in-c

So this turns to be more of a "libosmocore" ticket and what we'd like to do in order to support container_of in C++ non-gnu compilers.

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)