On Fri, Dec 14, 2018 at 02:12:31AM +0000, Ramsay Jones wrote: > > > On 14/12/2018 00:15, Luc Van Oostenryck wrote: > > Some types have already their TYPE/SIZEOF/MAX macros. > > These patches add them for the missing types: ptrdiff, > > int{ptr,max,64,32,16,8}_t and their unsigned version, > > wchar_t, wint_t, char{16,32}_t.. > > > > Note: some of the types vary a lot depending on the > > architecture, OS & exact ABI used. This is > > specially the case for for int32_t. > > The definition in these patches should now be correct > > for the most common archs & ABI used for the kernel. > > > > Changes since v1: > > * correct _MAX value of unsigned types (+ testing) > > * fix definition PTYPE_WIDTH/PTYPE_TYPE > > * fix inverted type for INT8/UINT8 > > * define shortcur PTYPE_ALL_T > > * add tests for PTRDIFF/SIZE/INTMAX/INT{8,16,32,64} > > * add definitions for wint_t, char16_t & char32t > > > > Changes since v2: > > * mv slong_ctype's entry in typenames after long_ctype > > * use the type for predefined_max() > > * add a temptative arch_mach initialized with the native > > architecture and use it to set more correctly wchar_t, > > int32_t, ... > > * fix size of long double, especially on x86-64 > > Heh, I was just about to email you about my testing this evening, when > I noticed a new series! ;-) > > The changes described above sound very interesting ... but I will > have leave the testing until tomorrow now. :-P > > I have tested the v2 on Linux Mint 19 64-bit, Linux Mint 18.3 32-bit, > cygwin 64-bit, fedora 28 64-bit, using gcc with versions 5.4.0, 7.3.0 > and 8.0.1. (I have been meaning to update fedora to 29, but haven't > got around to it). I'm running the testsuite on Debian & Ubuntu (and more recently Alpine) on x86-64 and Ubuntu on i386 plus some others (Debian powerpc64 & sparc64, Solaris 10 & 11 but using gcc not scc, OSX) but I still haven't done a systematic comparison of -dD's output. I'm much interested to know the changes needed for cygwin). > I was quite happy with v2, but v3 sounds even better! > > Some minor notes: > > - this series (v2) already goes beyond my simple patch and > covers everything I required to get a clean build of both > sparse (eg. selfcheck) and git. (no more need for SPARSE_FLAGS > on cygwin). > > - __WCHAR_TYPE__, et al, is a minor problem (as I mentioned > before), with -m32, -mx32, -m16 (on x86, x86-64) systems > defining the type as 'long' (rather than 'int'), except > on cygwin (of course), where it is defined as 'unsigned short'. It should be OK now on -v3 but for cygwin. > - __SIZEOF_LONG_DOUBLE__ is defined as 10 (for all archs) by > sparse, but it is defined as either 12 or 16 by gcc. This should also be OK now. > - older gcc (in this case v5.4.0), do not define any of the > __<type>_WIDTH__ macros. v7.3.0 and v8.0.1 _do_ define these > macros. This is not a problem - just a reminder that gcc and > clang (I don't know who is leading who here) do keep changing > the interface ... ;-) Yes, I know but indeed it's not a problem. > Thanks for all the hard work on this! Thanks for the testing @ the feedback! > I will hopefully find time to test v3 tomorrow (or over the weekend, > at least). Great. Thank you. -- Luc