summaryrefslogtreecommitdiff
path: root/include
AgeCommit message (Collapse)Author
2021-06-27Fix InternalCallbackRec layout if pointers are bigger than 64 bitsAlex Richardson
When running `xeyes` via `SSH -X` on CHERI-RISC-V FreeBSD, I was getting a Bus Error (unaligned store) in the `cl->callback = callback;` line of _XtAddCallback. The `cl` variable (created using `ToList(icl)`) was only aligned to 8 bytes, but for CHERI-RISC-V pointer-type loads and stores require 16-byte alignment. In order to fix this, I added a C99 flexible array member to internalCallbackRec when compiling for C99 or newer. This ensures that sizeof(InternalCallbackRec) is 16 (since it now includes the required 12 byte padding up to the first XtCallbackRec). This also ensures that alignof(InternalCallbackRec) is 16, but that doesn't matter in this case since malloc() will always return a sufficiently-aligned pointer. I also changed ToList(p) to use the flexible array member directly when compiling for C99. This is not a functional change since it will evaluate to the same pointer, but it does add additional type checking and ensures that only a `InternalCallbackRec *` can be passed to the macro. Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
2021-06-27Fix XrmResource layout if pointers are bigger than longAlex Richardson
On CHERI-enabled architectures (e.g. Arm's Morello), pointers are twice the size of addresses (i.e. 128 bits for Morello, 64 bits for 32-bit RISC-V). However, XtArgVal is currently defined as long, so it cannot be used to store pointers on these architectures. Also add a _Static_assert() when compiling with C11 support to check that the offset of the last member matches that of XtResource. Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
2021-06-27Use XtUIntPtr for integer types that can hold pointersAlex Richardson
Various Xt*Id types are integer types that are used to hold pointers. Use uintptr_t for standards-compliant conversion and to support architectures where long cannot hold pointers (e.g. CHERI). I found these by compiling libXt with the CHERI Clang compiler, as it warns about conversions from integer to pointer that do not use intptr_t. Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
2021-06-27XtArgVal: Support architectures where pointers are bigger than longAlex Richardson
On CHERI-enabled architectures (e.g. Arm's Morello), pointers are twice the size of addresses (i.e. 128 bits for Morello, 64 bits for 32-bit RISC-V). However, XtArgVal is currently defined as long, so it cannot be used to store pointers on these architectures. This commit changes XtArgVal to use intptr_t instead, which should be long on most architectures but is larger for CHERI. It also introduces XtIntPtr/XtUIntPtr which will be used in follow-up changes. This commit should also help on LLP64 ABIs where long is 32 bits but pointers are 64 bits. I am not sure what the compiler and C standard requirements are, so I've guarded the use of stdint.h with `#if __STDC_VERSION__ >= 199901L`. I've also added a _Static_assert() when compiling in C11 mode to statically verify that the XtArgVal type requirements are met. Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
2021-06-16Define LONG64 if __SIZEOF_LONG__ indicates 64-bit longAlex Richardson
All modern compilers (GCC>=4.6, Clang>=3.0) define this macro, so we can use it to detect 64-bit longs without adding to the architecture list. This change is needed to successfully run xeyes on a FreeBSD CHERI-RISC-V QEMU VM via SSH forwarding. See also https://gitlab.freedesktop.org/xorg/proto/xorgproto/-/merge_requests/41 Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
2019-07-07constify table passed to _XtTableAddConverter to reduce strict compiler warningsThomas E. Dickey
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-05-29build- and compiler-warning fixes when XTTRACEMEMORY is definedThomas E. Dickey
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-05-29add prototype for DEBUG-functionThomas E. Dickey
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-05-29fix compiler-warning when DEBUG is definedThomas E. Dickey
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-05-18use _X_NORETURN, works for gcc and clangThomas E. Dickey
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-05-06use "const void *" rather than "char *" for memcmp, etcThomas E. Dickey
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-05-06fix gcc warnings when assigning into a bit-field by first masking the valueThomas E. Dickey
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-04-21The interface changes made recently have to be documented, and due to theThomas E. Dickey
time interval, etc., in turn requires an update to the specification version. Update that now.
2019-04-16change return-type to avoid const-mismatchesThomas E. Dickey
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-04-16fix const-mismatches in TMprint.cThomas E. Dickey
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-04-16Allow all of the "argv" strings to be writable, since those arrays mayThomas E. Dickey
be updated during initialization. Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-04-16This is a minimal change which compiles when predefining _CONST_X_STRING,Thomas E. Dickey
by changing some function parameters and struct-members to _XtString (always "char*") from String (which may be "const char *"). There are still many compiler warnings; subsequent commits will reduce those. Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-04-15Referring to the xterm FAQThomas E. Dickey
https://invisible-island.net/xterm/xterm.faq.html#building_it I would like to add an optional feature which makes the String typedef "const" if _CONST_X_STRING is defined. Modifying the Intrinsic.h header is only a partial solution because the library has not been modified to take advantage of this (if it had, most of the const-warnings from gcc would go away). This change modifies the header file as well as the makestrs.c program which generates Shell.h and StringDefs.h so that they use String-casts rather than char*-casts (reducing the warnings seen when compiling with Xt's header files). Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-04-06This cleans up the "easy" warning fixes which can be made using myThomas E. Dickey
Regress script, comparing object-files before/after the edits: https://invisible-island.net/ansification/index.html https://invisible-island.net/scripts/readme.html The changes are casts, which quiet the gcc warnings about implicit conversion that my "gcc-normal" script would show. I avoided reformatting the code. The change reduces the number of gcc warnings from 769 to 163. Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-04-02bzero was marked "legacy" in POSIX 2001, and is not part of the later revisions.Thomas E. Dickey
Use memset, which is standard (and supported for some 30 years). Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-04-02Use standard size_t type in the casts for length-parameter of memcpy, memmoveThomas E. Dickey
and bzero. When the library was written (1989), none of those had been standardized, and the source-code used "(int)" casts to help with K&R compilers. The cleanup done in the previous update used binary-compare to validate, which does not work for these because the compiler is recording the cast's effect. This change reduces the number of gcc warnings from 163 to 128. Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-03-12fix build when XT_GEO_TATTLER is definedThomas E. Dickey
That turns on a debugging feature (activated by a resource setting). Its use of <stdarg.h> was incorrect. Also fix compiler warnings in the related file. Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2015-04-21Fix _XtInherit on x86_64 WindowsYaakov Selkowitz
As noted in Initialize.c, _XtInherit needs special treatment as it's both called as a function, and used as a value to compare with. We need to change this trickery for x86_64, as the symbols are no longer underscore prefixed, and the address is 64 bits. We also cannot place the trampoline in the .data section, as it may be marked no-execute, so we use a special section for it instead. v2: Uses of XtInherit must also be marked dllimport, so that they do not use a thunk, but instead indirect via the __imp_XtInherit auto-import. This avoids problems with an incorrect relocation being calculated in the case where libXt and a library using it (e.g. libXaw/libXaw3d/libXm/etc.) are loaded more than 2GiB apart from each other. This is enough to build a working libXt for Cygwin x86_64, because it uses the LP64 data model. I believe that more patches are needed for libXt to work correctly when built for the Windows LLP64 data model. Signed-off-by: Yaakov Selkowitz <yselkowitz@cygwin.com> Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk> Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2015-02-14unifdef -UCRAY -UCRAY2Alan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-10-03Strip trailing whitespaceAlan Coopersmith
Performed with: find * -type f | xargs perl -i -p -e 's{[ \t]+$}{}' git diff -w & git diff -b show no diffs from this change Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-02-04Remove unused #ifdef UNALIGNED version of Xt macros & functionsAlan Coopersmith
Trying to outsmart the compiler and libc is a losing battle, but since UNALIGNED was never defined, we weren't even trying. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-01-12Add XtAsprintf() as a new exported APIAlan Coopersmith
Like asprintf() but using XtMalloc() to tie into the Xt memory allocation and error handling subsystems. Bumps libXt version to 1.0.99.1 so that modules can set their pkg-config dependency to libXt >= 1.0.99.1 to require XtAsprintf(). Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2010-10-06Purge cvs tags.Jesse Adkins
Signed-off-by: Jesse Adkins <jesserayadkins@gmail.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2010-09-23Sun's copyrights belong to Oracle nowAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2010-01-14Update Sun license notices to current X.Org standard formAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
2009-10-22.gitignore: use common defaults with custom section # 24239Gaetan Nadon
Using common defaults will reduce errors and maintenance. Only the very small or inexistent custom section need periodic maintenance when the structure of the component changes. Do not edit defaults.
2009-01-30Janitor: ansification, make distcheck, compiler warnings, .gitignore.Paulo Cesar Pereira de Andrade
Most "compiler" warnings were actually sparse warnings, due to assigning a integer to a pointer, or an external symbol without a previous declaration.
2007-06-23Allow C++ apps to build using libXtJulien Cristau
2006-07-13renamed: .cvsignore -> .gitignoreAlan Coopersmith
2005-09-24Include <X11/XlibConf.h> to get correct XTHREADS settings in non-ImakeXORG-6_8_99_901Alan Coopersmith
builds.
2005-07-19distcheck fixes -- clean up after makestrs, don't list non-existant files.Daniel Stone
2005-07-09Add .cvsignore filesKeith Packard
2005-06-20- Make Xt install its internal files in /usr/include/X11, both in theSøren Sandmann Pedersen
modular and the monolithic tree. - Update XTrap to use #include <X11/internal-xt-headerI.h> - Add XvMC to symlink.sh
2005-05-18- conditionally include config.h in xc/lib/Xt sourcesXORG-6_8_99_8Søren Sandmann Pedersen
- add build system for lib/Xt
2005-05-17gcc4 allows to check if sentinels are correct (a sentinel is theEgbert Eich
terminating element in a varargs list). A sentinel needs to be NULL, not 0 - which doesn't make a difference on 32bit but matters on 64bit. Furthermore it can be told that functions have a printf-like format string and argument list so that they can verify that both match. To use these features certain attributes need to be set - which are compiler specific. To do this we define macros which are expanded depending on the compiler version. For now we put those in include/Xfuncproto.h (the XFree86 DDX layer contains a file compiler.h which however is not visible outside the DDX) (Bugzilla #3268).
2005-02-21Convert lib/Xt to ANSI C (Thomas Dickey). Fixes for a few valgrind warningsXORG-6_8_99_3XORG-6_8_99_2XORG-6_8_99_1Matthieu Herrb
(Thomas Dickey).
2004-08-11Apply PPC64 build patch (Bug #303, Mike A. Harris, Alan Coopersmith).rel-0-6-1lg3d-rel-0-7-0lg3d-baseXORG-6_8_1_901XORG-6_8_1XORG-6_8_0XORG-6_7_99_904XORG-6_7_99_903XORG-6_7_99_902XORG-6_7_99_901XORG-6_7_99_2lg3d-eventlg3d-dev-0-6-latestlg3d-dev-0-6-1-latestlg3d-dev-0-6-1-currentlg3d-dev-0-6-1lg3dKevin E Martin
2004-07-31Rename some COMPOSITE macros and enums to avoid conflicting with theXORG-6_7_99_1Eric Anholt
COMPOSITE extension's new macro. These appear to only be used internally.
2004-04-23Merging XORG-CURRENT into trunkXACE-SELINUX-MERGECOMPOSITEWRAPEgbert Eich
2004-03-14Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004xf86-4_4_99_1Egbert Eich
2004-03-03Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004xf86-4_4_0STSF-CURRENTEgbert Eich
2004-02-26readding XFree86's cvs IDsxf86-4_3_99_903Egbert Eich
2004-02-26Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004Egbert Eich
2003-11-25XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folksxf86-4_3_99_902xf86-4_3_99_901xf86-4_3_99_16Kaleb Keithley
2003-11-14XFree86 4.3.0.1xf86-4_3_0_1PRE_xf86-4_3_0_1Kaleb Keithley