Skip to content

Add stdint import for GCC 15 #890

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

arctic-alpaca
Copy link

Hi,
I'm using the newly released Fedora 42, which ships GCC 15 already, and encountered build errors. The errors are caused by GCC 15 requiring stdint.h to be explicitly imported (link):

In particular, the following headers are used less widely within libstdc++ and may need to be included explicitly when compiling with GCC 15:
    <stdint.h> (for int8_t, int32_t etc.) and <cstdint> (for std::int8_t, std::int32_t etc.)
    <ostream> (for std::endl, std::flush etc.)

This PR adds the required imports.

Build errors
In file included from /home/arctic-alpaca/git/vsomeip/interface/vsomeip/internal/plugin_manager.hpp:13,
                 from /home/arctic-alpaca/git/vsomeip/implementation/plugin/src/../include/plugin_manager_impl.hpp:9,
                 from /home/arctic-alpaca/git/vsomeip/implementation/plugin/src/plugin_manager.cpp:6:
/home/arctic-alpaca/git/vsomeip/interface/vsomeip/plugin.hpp:26:6: error: elaborated-type-specifier for a scoped enum must not use the ‘class’ keyword [-Werror]
   26 | enum class plugin_type_e : uint8_t {
      | ~~~~ ^~~~~
      |      -----
/home/arctic-alpaca/git/vsomeip/interface/vsomeip/plugin.hpp:26:26: error: found ‘:’ in nested-name-specifier, expected ‘::’
   26 | enum class plugin_type_e : uint8_t {
      |                          ^
      |                          ::
/home/arctic-alpaca/git/vsomeip/interface/vsomeip/plugin.hpp:26:12: error: ‘plugin_type_e’ has not been declared
   26 | enum class plugin_type_e : uint8_t {
      |            ^~~~~~~~~~~~~
/home/arctic-alpaca/git/vsomeip/interface/vsomeip/plugin.hpp:26:36: error: expected unqualified-id before ‘{’ token
   26 | enum class plugin_type_e : uint8_t {
      |                                    ^
/home/arctic-alpaca/git/vsomeip/interface/vsomeip/plugin.hpp:44:13: error: ‘uint32_t’ does not name a type
   44 |     virtual uint32_t get_plugin_version() const = 0;
      |             ^~~~~~~~
/home/arctic-alpaca/git/vsomeip/interface/vsomeip/plugin.hpp:1:1: note: ‘uint32_t’ is defined in header ‘<cstdint>’; this is probably fixable by adding ‘#include <cstdint>’
  +++ |+#include <cstdint>
    1 | // Copyright (C) 2016-2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
/home/arctic-alpaca/git/vsomeip/interface/vsomeip/plugin.hpp:46:13: error: ‘plugin_type_e’ does not name a type
   46 |     virtual plugin_type_e get_plugin_type() const = 0;
      |             ^~~~~~~~~~~~~
/home/arctic-alpaca/git/vsomeip/interface/vsomeip/plugin.hpp:56:43: error: ‘uint32_t’ has not been declared [-Wtemplate-body]
   56 |     plugin_impl(const std::string &_name, uint32_t _version,
      |                                           ^~~~~~~~
/home/arctic-alpaca/git/vsomeip/interface/vsomeip/plugin.hpp:56:43: note: ‘uint32_t’ is defined in header ‘<cstdint>’; this is probably fixable by adding ‘#include <cstdint>’
/home/arctic-alpaca/git/vsomeip/interface/vsomeip/plugin.hpp:57:17: error: ‘plugin_type_e’ has not been declared; did you mean ‘plugin_impl’? [-Wtemplate-body]
   57 |                 plugin_type_e _type) {
      |                 ^~~~~~~~~~~~~
      |                 plugin_impl
/home/arctic-alpaca/git/vsomeip/interface/vsomeip/plugin.hpp:67:5: error: ‘uint32_t’ does not name a type [-Wtemplate-body]
   67 |     uint32_t get_plugin_version() const {
      |     ^~~~~~~~
/home/arctic-alpaca/git/vsomeip/interface/vsomeip/plugin.hpp:67:5: note: ‘uint32_t’ is defined in header ‘<cstdint>’; this is probably fixable by adding ‘#include <cstdint>’
/home/arctic-alpaca/git/vsomeip/interface/vsomeip/plugin.hpp:71:5: error: ‘plugin_type_e’ does not name a type; did you mean ‘plugin_impl’? [-Wtemplate-body]
   71 |     plugin_type_e get_plugin_type() const {
      |     ^~~~~~~~~~~~~
      |     plugin_impl
/home/arctic-alpaca/git/vsomeip/interface/vsomeip/plugin.hpp:76:5: error: ‘uint32_t’ does not name a type [-Wtemplate-body]
   76 |     uint32_t version_;
      |     ^~~~~~~~
/home/arctic-alpaca/git/vsomeip/interface/vsomeip/plugin.hpp:76:5: note: ‘uint32_t’ is defined in header ‘<cstdint>’; this is probably fixable by adding ‘#include <cstdint>’
/home/arctic-alpaca/git/vsomeip/interface/vsomeip/plugin.hpp:78:5: error: ‘plugin_type_e’ does not name a type; did you mean ‘plugin_impl’? [-Wtemplate-body]
   78 |     plugin_type_e type_;
      |     ^~~~~~~~~~~~~
      |     plugin_impl
/home/arctic-alpaca/git/vsomeip/interface/vsomeip/plugin.hpp: In constructor ‘vsomeip_v3::plugin_impl<Plugin_>::plugin_impl(const std::string&, int, int)’:
/home/arctic-alpaca/git/vsomeip/interface/vsomeip/plugin.hpp:59:9: error: ‘version_’ was not declared in this scope; did you mean ‘_version’? [-Wtemplate-body]
   59 |         version_ = _version;
      |         ^~~~~~~~
      |         _version
/home/arctic-alpaca/git/vsomeip/interface/vsomeip/plugin.hpp:60:9: error: ‘type_’ was not declared in this scope [-Wtemplate-body]
   60 |         type_ = _type;
      |         ^~~~~
/home/arctic-alpaca/git/vsomeip/interface/vsomeip/internal/plugin_manager.hpp: At global scope:
/home/arctic-alpaca/git/vsomeip/interface/vsomeip/internal/plugin_manager.hpp:22:63: error: ‘plugin_type_e’ has not been declared; did you mean ‘plugin_impl’?
   22 |     VSOMEIP_EXPORT virtual std::shared_ptr<plugin> get_plugin(plugin_type_e _type, const std::string &_name) = 0;
      |                                                               ^~~~~~~~~~~~~
      |                                                               plugin_impl
/home/arctic-alpaca/git/vsomeip/interface/vsomeip/internal/plugin_manager.hpp:26:47: error: ‘plugin_type_e’ has not been declared; did you mean ‘plugin_impl’?
   26 |     VSOMEIP_EXPORT virtual bool unload_plugin(plugin_type_e _type) = 0;
      |                                               ^~~~~~~~~~~~~
      |                                               plugin_impl
/home/arctic-alpaca/git/vsomeip/implementation/plugin/src/../include/plugin_manager_impl.hpp:32:59: error: ‘plugin_type_e’ has not been declared; did you mean ‘plugin_impl’?
   32 |         VSOMEIP_EXPORT std::shared_ptr<plugin> get_plugin(plugin_type_e _type,
      |                                                           ^~~~~~~~~~~~~
      |                                                           plugin_impl
/home/arctic-alpaca/git/vsomeip/implementation/plugin/src/../include/plugin_manager_impl.hpp:36:46: error: ‘plugin_type_e’ has not been declared; did you mean ‘plugin_impl’?
   36 |                 const std::string& _library, plugin_type_e _type,
      |                                              ^~~~~~~~~~~~~
      |                                              plugin_impl
/home/arctic-alpaca/git/vsomeip/implementation/plugin/src/../include/plugin_manager_impl.hpp:39:43: error: ‘plugin_type_e’ has not been declared; did you mean ‘plugin_impl’?
   39 |         VSOMEIP_EXPORT bool unload_plugin(plugin_type_e _type);
      |                                           ^~~~~~~~~~~~~
      |                                           plugin_impl
/home/arctic-alpaca/git/vsomeip/implementation/plugin/src/../include/plugin_manager_impl.hpp:51:18: error: ‘plugin_type_e’ was not declared in this scope; did you mean ‘plugin_impl’?
   51 |         std::map<plugin_type_e, std::map<std::string, std::shared_ptr<plugin> > > plugins_;
      |                  ^~~~~~~~~~~~~
      |                  plugin_impl
/home/arctic-alpaca/git/vsomeip/implementation/plugin/src/../include/plugin_manager_impl.hpp:51:81: error: template argument 1 is invalid
   51 |         std::map<plugin_type_e, std::map<std::string, std::shared_ptr<plugin> > > plugins_;
      |                                                                                 ^
/home/arctic-alpaca/git/vsomeip/implementation/plugin/src/../include/plugin_manager_impl.hpp:51:81: error: template argument 3 is invalid
/home/arctic-alpaca/git/vsomeip/implementation/plugin/src/../include/plugin_manager_impl.hpp:51:81: error: template argument 4 is invalid
/home/arctic-alpaca/git/vsomeip/implementation/plugin/src/../include/plugin_manager_impl.hpp:52:18: error: ‘plugin_type_e’ was not declared in this scope; did you mean ‘plugin_impl’?
   52 |         std::map<plugin_type_e, std::map<std::string, void*> > handles_;
      |                  ^~~~~~~~~~~~~
      |                  plugin_impl
/home/arctic-alpaca/git/vsomeip/implementation/plugin/src/../include/plugin_manager_impl.hpp:52:62: error: template argument 1 is invalid
   52 |         std::map<plugin_type_e, std::map<std::string, void*> > handles_;
      |                                                              ^
/home/arctic-alpaca/git/vsomeip/implementation/plugin/src/../include/plugin_manager_impl.hpp:52:62: error: template argument 3 is invalid
/home/arctic-alpaca/git/vsomeip/implementation/plugin/src/../include/plugin_manager_impl.hpp:52:62: error: template argument 4 is invalid
cc1plus: all warnings being treated as errors
make[2]: *** [CMakeFiles/vsomeip3.dir/build.make:471: CMakeFiles/vsomeip3.dir/implementation/plugin/src/plugin_manager.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from /home/arctic-alpaca/git/vsomeip/implementation/plugin/src/plugin_manager_impl.cpp:20:
/home/arctic-alpaca/git/vsomeip/interface/vsomeip/plugins/application_plugin.hpp:19:6: error: elaborated-type-specifier for a scoped enum must not use the ‘class’ keyword [-Werror]
   19 | enum class application_plugin_state_e : uint8_t {
      | ~~~~ ^~~~~
      |      -----
/home/arctic-alpaca/git/vsomeip/interface/vsomeip/plugins/application_plugin.hpp:19:39: error: found ‘:’ in nested-name-specifier, expected ‘::’
   19 | enum class application_plugin_state_e : uint8_t {
      |                                       ^
      |                                       ::
/home/arctic-alpaca/git/vsomeip/interface/vsomeip/plugins/application_plugin.hpp:19:12: error: ‘application_plugin_state_e’ has not been declared
   19 | enum class application_plugin_state_e : uint8_t {
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/arctic-alpaca/git/vsomeip/interface/vsomeip/plugins/application_plugin.hpp:19:49: error: expected unqualified-id before ‘{’ token
   19 | enum class application_plugin_state_e : uint8_t {
      |                                                 ^
/home/arctic-alpaca/git/vsomeip/interface/vsomeip/plugins/application_plugin.hpp:37:19: error: ‘application_plugin_state_e’ does not name a type; did you mean ‘application_plugin’?
   37 |             const application_plugin_state_e _app_state) = 0;
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~
      |                   application_plugin
cc1plus: all warnings being treated as errors
make[2]: *** [CMakeFiles/vsomeip3.dir/build.make:485: CMakeFiles/vsomeip3.dir/implementation/plugin/src/plugin_manager_impl.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:252: CMakeFiles/vsomeip3.dir/all] Error 2
make: *** [Makefile:146: all] Error 2

@duartenfonseca
Copy link
Collaborator

@arctic-alpaca can you please look at the small change to the PR? thanks!

@arctic-alpaca
Copy link
Author

@duartenfonseca I'm not sure what you are referring to, could you elaborate? I don't see any comments on the PR besides yours (review or otherwise).

@duartenfonseca
Copy link
Collaborator

@arctic-alpaca the reason was to use the c++ version of the same lib. I am the maintainer and was looking to merge this PR

Comment on lines 11 to 12
#include <stdint.h>

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#include <stdint.h>
#include <cstdint>

@@ -8,6 +8,7 @@

#include <string>
#include <memory>
#include <stdint.h>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#include <stdint.h>
#include <cstdint>

@duartenfonseca
Copy link
Collaborator

duartenfonseca commented May 28, 2025

@arctic-alpaca now i understood what you were saying. i didn't submit the review, it was still ongoing. sorry!
Now it is submitted

@arctic-alpaca
Copy link
Author

@duartenfonseca I see 😃 The PR is using the C++ import now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants