[PATCH v2] rtems-utils: Change data type definition
Ryan Long
ryan.long at oarcorp.com
Mon Aug 9 12:48:01 UTC 2021
Without the global namespace prefix, it results in the following error
../linkers/rtems-exeinfo.cpp: In member function ‘void rld::exeinfo::image::output_compilation_unit(bool, bool)’:
../linkers/rtems-exeinfo.cpp:370:14: error: ‘rld::rtems::utils’ has not been declared
rtems::utils::ostream_guard old_state( std::cout );
^
../linkers/rtems-exeinfo.cpp:370:35: error: expected ‘;’ before ‘old_state’
rtems::utils::ostream_guard old_state( std::cout );
Alex and I determined that the compiler is thinking that ostream_guard is defined in the rld::rtems namespace. This was the only way we figured out how to get it to compile without the typedef at the top of the file.
-----Original Message-----
From: Chris Johns <chrisj at rtems.org>
Sent: Friday, August 6, 2021 12:46 AM
To: Ryan Long <ryan.long at oarcorp.com>; devel at rtems.org
Subject: Re: [PATCH v2] rtems-utils: Change data type definition
On 6/8/21 6:43 am, Ryan Long wrote:
> Remove typedef of ostream_guard and change datatype of ostream_guards
> to have the namespace in the variable declarations.
> ---
> linkers/rtems-exeinfo.cpp | 6 ++----
> tester/covoar/CoverageMapBase.cc | 4 +---
> tester/covoar/ReportsHtml.cc | 4 +---
> tester/covoar/ReportsText.cc | 4 +---
> 4 files changed, 5 insertions(+), 13 deletions(-)
>
> diff --git a/linkers/rtems-exeinfo.cpp b/linkers/rtems-exeinfo.cpp
> index c9bf5b6..caae168 100644
> --- a/linkers/rtems-exeinfo.cpp
> +++ b/linkers/rtems-exeinfo.cpp
> @@ -53,8 +53,6 @@
> #define kill(p,s) raise(s)
> #endif
>
> -typedef rtems::utils::ostream_guard ostream_guard;
> -
> namespace rld
> {
> namespace exeinfo
> @@ -369,7 +367,7 @@ namespace rld
> */
>
> rld::strings all_flags;
> - ostream_guard old_state( std::cout );
> + ::rtems::utils::ostream_guard old_state( std::cout );
>
> size_t source_max = 0;
>
> @@ -636,7 +634,7 @@ namespace rld
>
> void image::output_tls ()
> {
> - ostream_guard old_state( std::cout );
> + ::rtems::utils::ostream_guard old_state( std::cout );
Why the global namespace prefix, ie `::` at the start? I have only seen this when referencing a global symbol that is not in a namespace, ie a C call.
Chris
More information about the devel
mailing list