Issue 25651 - Consolidate tools & sal type declarations
Summary: Consolidate tools & sal type declarations
Status: CLOSED FIXED
Alias: None
Product: porting
Classification: Code
Component: code (show other issues)
Version: OOo 1.1 RC5
Hardware: All All
: P3 Trivial (vote)
Target Milestone: OOo 2.0
Assignee: fa
QA Contact: issues@porting
URL:
Keywords:
Depends on:
Blocks: 8577
  Show dependency tree
 
Reported: 2004-02-18 19:00 UTC by fa
Modified: 2004-09-08 22:38 UTC (History)
7 users (show)

See Also:
Issue Type: PATCH
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
Patch for tools (6.08 KB, patch)
2004-02-18 19:01 UTC, fa
no flags Details | Diff
patch for sal (3.34 KB, patch)
2004-02-18 19:01 UTC, fa
no flags Details | Diff
unzip into sal/, so that a sal/typesconfig exists (439.51 KB, application/x-gzip)
2004-02-18 19:02 UTC, fa
no flags Details
updated patch (6.45 KB, patch)
2004-02-19 21:47 UTC, fa
no flags Details | Diff
updated patch (9.61 KB, patch)
2004-02-19 21:48 UTC, fa
no flags Details | Diff
updated typesconfig program (4.37 KB, patch)
2004-02-19 21:48 UTC, fa
no flags Details | Diff
Updated tools/ patch, use instead of tools.20040219.patch (9.47 KB, patch)
2004-02-20 00:10 UTC, fa
no flags Details | Diff
patches for modules switching to SAL_TYPES_*, except for __LITTLEENDIAN and __BIGENDIAN (7.29 KB, application/x-gzip)
2004-02-20 01:02 UTC, fa
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description fa 2004-02-18 19:00:13 UTC
To alleviate future confusion and to consolidate code, how about the
following?
                                                                               
              
a) tools/inc/solar.h types are neat, because their length is
autogenerated
                                                                               
              
b) sal/inc/sal/types.h types are neat too, becasue they are much more
descriptive and more varied
                                                                               
              
There seems to be a general consensus to standardize on the sal/types.h
code, but of course its lengths are not automatically
computed.  Therefore:
                                                                               
              
1) Move tools/source/solar/solar.c (mksvconf) into sal
2) sal's mksvconf will create sal/inc/sal/svconf.h
3) sal/inc/sal/types.h will #include sal/inc/sal/svconf.h
4) tools/inc/solar.h will #include sal/inc/types.h
5) tools/inc/svconf.h will #warning "use sal/svconf.h" and then #include
<sal/svconf.h>
6) For tools/inc/solar.h, we will re-define its types to be the
sal/inc/sal/types.h types
Comment 1 fa 2004-02-18 19:01:19 UTC
Created attachment 13268 [details]
Patch for tools
Comment 2 fa 2004-02-18 19:01:37 UTC
Created attachment 13269 [details]
patch for sal
Comment 3 fa 2004-02-18 19:02:10 UTC
Created attachment 13270 [details]
unzip into sal/, so that a sal/typesconfig exists
Comment 4 fa 2004-02-18 19:03:00 UTC
To get this to work:

1) apply patch to tools
2) delete tools/source/solar directory
3) apply patch to sal
4) unzip typesconfig.tar.gz in sal, so that a sal/typesconfig directory exists
Comment 5 Stephan Bergmann 2004-02-19 13:52:21 UTC
Looking at sal.diff, I have a number of questions:
1  What is the _SOLAR_NODESCRIPTION define good for?  Also, it is an illegal
macro name (it starts with an underline followed by an uppercase letter), and
the notion of "solar" does not fit with the notion of "sal," I think.
2  Please replace the lines

  #else  /* UNX */
  #if defined WNT /* auf PC's */

with the single line

  #elsif defined WNT

which is much more readable.
3  All the macro names from __LITTLEENDIAN to __IEEEDOUBLE are illegal (they
contain a double underscore).
4  Macros for little vs. big endian are already available in osl/endian.h.
5  __SIZEOFCHAR is of no use, as sizeof (char) must always equal one, anyway.
6  The codified assumption that "sizeof (long) != 4" implies that [unsinged] int
has enough non-padding bits to represent all the values we expect to store in an
object of type sal_[u]Int32 is false.

I had naively thought that the generated sal/typesizes.h would be available on
all platforms, and would already contain the relevant typedefs and macros
(sal_[u]Int8/16/32/64 and SAL_CONST_[U]INT64), instead of this two-stage process
(which, on the one hand, would be applied inconsistently, as the information
from sal/typesizes.h is only used to determine the typedef of sal_[u]Int32, and
not for sal_[u]Int8/16/64, and, on the other hand, is generally dangerous, as
the sizes (as per sizeof) of integer types alone are not sufficient to determine
what integer types, if any, are the best candidates for our sal_[u]Int8/16/32/64).
Comment 6 fa 2004-02-19 15:12:55 UTC
1) _SOLAR_NODESCRIPTION is directly from tools/solar.h, and I was concerned enough about it to 
include it here since there are things that could break if it wasn't.  What those are, I don't know, and it 
may be a completely historical artefact.

2) Will do.

3) Will change macro names

4) Does this work on Windows?  Will the test program ever work on Windows?  If it would, then we 
should not use osl/endian.h and instead generate such things with the test program.

5) Will remove SIZEOFCHAR

6) Explain a bit more what you mean here.

If its not as much as you hoped it would be, then lets make it so.  This is still very useful on Unix-based 
OSs, even _between_ versions of Unix-based OSs, to determine things like 64-bitness and other 
problems with assumptions that we might make (long being 32-bits for example).
Comment 7 fa 2004-02-19 21:15:05 UTC
Also, why should it autodetect sal_[u]Int8 when you state we are assuming that char is always 8-bit?  I 
think the solution here is to define based on the macros for 16/32/64 bit types.  There's also AFAIK no 
good way to determine "SAL_CONST_[U]INT64" either, suggestions welcome.
Comment 8 fa 2004-02-19 21:47:43 UTC
Created attachment 13296 [details]
updated patch
Comment 9 fa 2004-02-19 21:48:03 UTC
Created attachment 13297 [details]
updated patch
Comment 10 fa 2004-02-19 21:48:45 UTC
Created attachment 13298 [details]
updated typesconfig program
Comment 11 fa 2004-02-19 21:51:21 UTC
Changes include:
1) removal of stack stuff from typesconfig program, some parts were used (stack direction) and other 
parts (stack alignment) were only used on Classic Mac OS
2) removal of typesizing for "char" types, since Stephan said we should always assume 8-bits
3) check sizes for 16, 32, and 64-bit types in sal/typesizes.h
4) clean up 64-bit type defines in tools/solar.h
5) spacing improvements
Comment 12 fa 2004-02-20 00:10:49 UTC
Created attachment 13301 [details]
Updated tools/ patch, use instead of tools.20040219.patch
Comment 13 fa 2004-02-20 00:38:57 UTC
Due to Stephan's request for renaming the __ defines, there will be many more modules to be touched.  
I vote that we do not attempt to fix all the __LITTLEENDIAN and __BIGENDIAN defines right now (as 
there are a lot) but instead temporarily define then to be their SAL_TYPES_xxx counterparts.
Comment 14 fa 2004-02-20 01:02:23 UTC
Created attachment 13305 [details]
patches for modules switching to SAL_TYPES_*, except for __LITTLEENDIAN and __BIGENDIAN
Comment 15 Martin Hollmichel 2004-02-20 11:15:05 UTC
reassign to fa, as Dan takes care of this.
Comment 16 Stephan Bergmann 2004-02-23 10:11:53 UTC
We are less flexible with the contents of sal than with the contents of tools
(since sal is part of the published SDK API; whatever we add to sal has to be
maintained "forever"), so I would like to propose to reduce the number of macros
added to sal a little:

-  Use the already existing OSL_LIT/BIGENDIAN from osl/endian.h, instead of
defining new SAL_TYPES_LITTLE/BIGENDIAN in sal/typesizes.h or sal/types.h.

-  At least on platforms with 8-bit bytes and no padding in arithmetic types
(see below), supporting IEC 60559 (aka IEEE 754) implies that sizeof (double) ==
8, so that SAL_TYPES_SIZEOFDOUBLE can be removed.

-  Support for IEC 60559 (aka IEEE 754) is an assumption that cannot be lifted
anyway (see below), so I'd vote to drop SAL_TYPES_IEEEDOUBLE.

Our code is based on some assumptions about a platform.  There are probably too
many places in the code that rely on these assumptions (and these assumptions
are probably met by all current hardware, anyway), to make it realistic to get
rid of these assumptions.  Among these assumptions are:
-  A byte has eight bits.
-  Arithmetic types have no padding bits.
-  Signed integral types use two's complement.
-  Floating point types use IEC 60559.
Comment 17 fa 2004-03-19 16:06:53 UTC
committed to cws_src680_ooo64bit01 with sba's suggestions
Comment 18 pavel 2004-09-08 22:38:01 UTC
Verified, closing.