lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] Branch lmi-so


From: Greg Chicares
Subject: Re: [lmi] Branch lmi-so
Date: Sun, 18 Oct 2020 14:55:58 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0

On 2020-10-18 12:47, Greg Chicares wrote:
> This branch generally moves "LMI_SO" to the left, e.g.:
> 
> -void LMI_SO authenticate_system();
> +LMI_SO void authenticate_system();
> 
> but in 'basic_tables.cpp', "LMI_SO" is removed, e.g.:
> 
> -std::vector<double> LMI_SO irc_7702_q_builtin
> +std::vector<double> irc_7702_q_builtin
> 
> Is that intentional, and if so, what's the reason?

Oh, wait--I think I see it now. "LMI_SO" is removed from
 - definitions in '.cpp' files, where it already decorates the corresponding
 - declarations in '.hpp' files.
This occurred in 'basic_tables.?pp' and 'path_utility.?pp'.

And this function:
-  LMI_SO std::vector<double> irc_7702_q_builtin
+  std::vector<double> irc_7702_q_builtin
should probably be in an unnamed namespace, because it's not mentioned in
the header.

This all looks perfect to me now. BTW, I checked it by running the
following command, which moves "LMI_SO" leftward, reading from my
convenient local mirror of origin/master and writing to a newly
created throwaway directory:

/opt/lmi/free/src/lmi[0]$for z in `grep -l -P '(?<!class )LMI_SO' *.?pp`; do 
<$z >/opt/lmi/stash/so/$z sed -e'/\(class\|struct\|extern\) 
*LMI_SO/!s/\(^.*\)\(LMI_SO \)\(.*$\)/\2\1\3/'; done

Negative lookbehind isn't supported by 'sed', but a negated range
accomplishes the same thing.

Concerning the commit below, I'd just like to make an observation:
apparently the "SO" decoration for forward declarations is...
  #define LMI_SO_FWD_DECL        // GNU/Linux current gcc
  #define LMI_SO_FWD_DECL        // MinGW-w64 since we began using it
  #define LMI_SO_FWD_DECL LMI_SO // historical mingw.org gcc
if I understand it now (after misunderstanding on the first few
readings); therefore, the preceding documentation:

// [...] It is unknown
// whether this difference represents deliberate evolution of gcc or
// a MinGW-w64 regression, so both versions are preserved.

can now be revised (it really is evolution, and perhaps mingw.org
was just lax in accepting the decoration); and in fact we could
simplify it from this:

#   if defined __GNUC__
#       if defined LMI_MINGW_W64
#           define LMI_SO_FWD_DECL
#       else  // !defined LMI_MINGW_W64
#           define LMI_SO_FWD_DECL
#       endif // !defined LMI_MINGW_W64
#   else  // !defined __GNUC__

to something like this:

#   if defined __GNUC__
#       define LMI_SO_FWD_DECL
#   else  // !defined __GNUC__

Here's the commit mentioned above:

    Fix the SO attribute for the class forward delaration
    
    Fix the error for the Linux native build:
    error: type attributes ignored after type is already defined 
[-Werror=attributes]

diff --git a/so_attributes.hpp b/so_attributes.hpp
index b8511dfa..d35b05d3 100644
--- a/so_attributes.hpp
+++ b/so_attributes.hpp
@@ -124,7 +124,7 @@
 #       if defined LMI_MINGW_W64
 #           define LMI_SO_FWD_DECL
 #       else  // !defined LMI_MINGW_W64
-#           define LMI_SO_FWD_DECL LMI_SO
+#           define LMI_SO_FWD_DECL
 #       endif // !defined LMI_MINGW_W64
 #   else  // !defined __GNUC__
 #       define LMI_SO_FWD_DECL LMI_SO


reply via email to

[Prev in Thread] Current Thread [Next in Thread]