CiscoDevNet / ydk-gen

Generate model-driven APIs from YANG models
http://ciscodevnet.github.io/ydk-gen/
Apache License 2.0
135 stars 74 forks source link

c++ generated bundle class fails to compile in gcc when model contains leaf 'minor' #1024

Closed ericjmonson closed 2 years ago

ericjmonson commented 4 years ago

Issue tracker is ONLY used for reporting bugs. Please use the YDK Community for any support issues.

Expected Behavior

It is expected that the cisco_ios_xe bundle will successfully compile using gcc.

Current Behavior

Does not compile due to minor being interpreted as a macro in gcc that maps to 'gnu_devminor'. It appears that any leaf node with the name "major" is renamed "major" in the code. It would seem that doing the same for minor would resolve the problem.

Steps to Reproduce

Download the latest repo. Generate the cisco_ios_xe bundle. Try to compile it:

Your Script

Logs

In file included from /usr/include/sys/types.h:222:0, from /usr/include/stdlib.h:314, from /usr/include/c++/4.8.2/cstdlib:72, from /usr/include/c++/4.8.2/ext/string_conversions.h:41, from /usr/include/c++/4.8.2/bits/basic_string.h:2815, from /usr/include/c++/4.8.2/string:52, from /usr/include/c++/4.8.2/bits/locale_classes.h:40, from /usr/include/c++/4.8.2/bits/ios_base.h:41, from /usr/include/c++/4.8.2/ios:42, from /usr/include/c++/4.8.2/istream:38, from /usr/include/c++/4.8.2/sstream:38, from /tmp/ydk-gen-master/gen-api/cpp/cisco_ios_xe-bundle/ydk/models/cisco_ios_xe/fragmented/Cisco_IOS_XE_native_223.cpp:2: /tmp/ydk-gen-master/gen-api/cpp/cisco_ios_xe-bundle/ydk/models/cisco_ios_xe/fragmented/Cisco_IOS_XE_native_223.cpp: In constructor 'cisco_ios_xe::Cisco_IOS_XEnative::Native::Event::Manager::Applet::Event::Env::Severity::Severity()': /tmp/ydk-gen-master/gen-api/cpp/cisco_ios_xe-bundle/ydk/models/cisco_ios_xe/fragmented/Cisco_IOS_XE_native_223.cpp:2814:7: error: class 'cisco_ios_xe::Cisco_IOS_XEnative::Native::Event::Manager::Applet::Event::Env::Severity' does not have any field named 'gnu_dev_minor' , minor(nullptr) // presence node

System Information

Centos 7 / gcc 4.8.5 / python 3.6.8 / x86_64

ygorelik commented 3 years ago

Resolved in YDK 0.8.5.

ygorelik commented 2 years ago

Resolved in release 0.8.5.