[AGENT++] src/asn1.cpp:386:5: error: ISO C++17 does not allow 'register' storage class specifier

J.R. Heisey jrheisey at raytheon.com
Tue Aug 21 22:34:37 CEST 2018


Correction the clang command line. Same option values apply.
There are also the options "--std=c++14" and "--std=c++03".

https://clang.llvm.org/cxx_status.html
Note that this page uses on dash instead of two for the option.

Thanks,
J.R. Heisey
X2949 AST
+1 408.522.2949



-----Original Message-----
From: AGENTPP [mailto:agentpp-bounces at agentpp.org] On Behalf Of J.R. Heisey
Sent: Tuesday, August 21, 2018 1:27 PM
To: Claus Klein <claus.klein at arcormail.de>; agentpp at agentpp.org
Subject: [External] Re: [AGENT++] src/asn1.cpp:386:5: error: ISO C++17 does not allow 'register' storage class specifier

Claus,

I see "--std=c++17 " on the command line to g++.
I suspect that the snmp++ code is not written to conform to this new standard.
Try "--std=c++11" or "--std=c++98"

Thanks,
J.R. Heisey
X2949 AST
+1 408.522.2949


-----Original Message-----
From: AGENTPP [mailto:agentpp-bounces at agentpp.org] On Behalf Of Claus Klein
Sent: Tuesday, August 21, 2018 1:22 PM
To: agentpp at agentpp.org
Subject: [External] [AGENT++] src/asn1.cpp:386:5: error: ISO C++17 does not allow 'register' storage class specifier

Hi,

I have problems to compile snmp++ with newer clang++ compiler

Best regards
Claus

Making all in src
make[2]: Verzeichnis „/Users/clausklein/Downloads/snmp++-3.3.10/build/src“ wird betreten
/bin/sh ../libtool --tag=CXX   --mode=compile clang++ -DHAVE_CONFIG_H -I. -I../../src -I..  -I/Users/clausklein/Downloads/snmp++-3.3.10/build/../include -D_THREAD_SAFE   -DHAVE_LIBSSL -I/opt/local/include  --std=c++17 -Wpedantic -Wextra -Wall -D_THREAD_SAFE  -MT address.lo -MD -MP -MF .deps/address.Tpo -c -o address.lo ../../src/address.cpp
libtool: compile:  clang++ -DHAVE_CONFIG_H -I. -I../../src -I.. -I/Users/clausklein/Downloads/snmp++-3.3.10/build/../include -D_THREAD_SAFE -DHAVE_LIBSSL -I/opt/local/include --std=c++17 -Wpedantic -Wextra -Wall -D_THREAD_SAFE -MT address.lo -MD -MP -MF .deps/address.Tpo -c ../../src/address.cpp  -fno-common -DPIC -o .libs/address.o
libtool: compile:  clang++ -DHAVE_CONFIG_H -I. -I../../src -I.. -I/Users/clausklein/Downloads/snmp++-3.3.10/build/../include -D_THREAD_SAFE -DHAVE_LIBSSL -I/opt/local/include --std=c++17 -Wpedantic -Wextra -Wall -D_THREAD_SAFE -MT address.lo -MD -MP -MF .deps/address.Tpo -c ../../src/address.cpp -o address.o >/dev/null 2>&1 mv -f .deps/address.Tpo .deps/address.Plo
/bin/sh ../libtool --tag=CXX   --mode=compile clang++ -DHAVE_CONFIG_H -I. -I../../src -I..  -I/Users/clausklein/Downloads/snmp++-3.3.10/build/../include -D_THREAD_SAFE   -DHAVE_LIBSSL -I/opt/local/include  --std=c++17 -Wpedantic -Wextra -Wall -D_THREAD_SAFE  -MT asn1.lo -MD -MP -MF .deps/asn1.Tpo -c -o asn1.lo ../../src/asn1.cpp
libtool: compile:  clang++ -DHAVE_CONFIG_H -I. -I../../src -I.. -I/Users/clausklein/Downloads/snmp++-3.3.10/build/../include -D_THREAD_SAFE -DHAVE_LIBSSL -I/opt/local/include --std=c++17 -Wpedantic -Wextra -Wall -D_THREAD_SAFE -MT asn1.lo -MD -MP -MF .deps/asn1.Tpo -c ../../src/asn1.cpp  -fno-common -DPIC -o .libs/asn1.o
../../src/asn1.cpp:386:5: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    register int header_len;
    ^~~~~~~~~
1 error generated.
make[2]: *** [Makefile:471: asn1.lo] Fehler 1
make[2]: Verzeichnis „/Users/clausklein/Downloads/snmp++-3.3.10/build/src“ wird verlassen
make[1]: *** [Makefile:508: all-recursive] Fehler 1
make[1]: Verzeichnis „/Users/clausklein/Downloads/snmp++-3.3.10/build“ wird verlassen
make: *** [Makefile:393: all] Fehler 2
Claus-MBP:build clausklein$ clang++ --version clang version 5.0.2 (tags/RELEASE_502/final)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /opt/local/libexec/llvm-5.0/bin


There are also cppcheck serious warnings:

src/auth_priv.cpp:2046:0: warning: Object pointed by an 'auto_ptr' is destroyed using operator 'delete'. You should not use 'auto_ptr' for pointers obtained with operator 'new[]'. [useAutoPointerArray]
    std::auto_ptr<unsigned char> ipad(new unsigned char[block_size]); ^
src/auth_priv.cpp:2047:0: warning: Object pointed by an 'auto_ptr' is destroyed using operator 'delete'. You should not use 'auto_ptr' for pointers obtained with operator 'new[]'. [useAutoPointerArray]
    std::auto_ptr<unsigned char> opad(new unsigned char[block_size]); ^

Checking src/md5c.cpp ...
src/log.cpp:344:0: warning: Non reentrant function 'localtime' called. For threadsafe applications it is recommended to use the reentrant replacement function 'localtime_r'. [localtimeCalled]
    struct tm* stm = localtime(&t);
^
src/log.cpp:346:0: warning: Non reentrant function 'localtime' called. For threadsafe applications it is recommended to use the reentrant replacement function 'localtime_r'. [localtimeCalled]
        strftime(buf, 18, "%Y%m%d.%H:%M:%S", localtime(&t)); ^

_______________________________________________
AGENTPP mailing list
AGENTPP at agentpp.org
https://oosnmp.net/mailman/listinfo/agentpp
_______________________________________________
AGENTPP mailing list
AGENTPP at agentpp.org
https://oosnmp.net/mailman/listinfo/agentpp


More information about the AGENTPP mailing list