Walk back most uses of __STRICT_ANSI__

This commit is contained in:
Justine Tunney 2024-02-27 04:09:49 -08:00
parent 7c7bf4bb90
commit 0ef36489c8
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
11 changed files with 109 additions and 193 deletions

View file

@ -1,7 +1,7 @@
#ifndef COSMOPOLITAN_LIBC_NT_TEB_H_
#define COSMOPOLITAN_LIBC_NT_TEB_H_
#include "libc/nt/struct/peb.h"
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
#ifdef __GNUC__
/*
* These macros address directly into NT's TEB a.k.a. TIB
@ -21,5 +21,5 @@
#define _NtGetRpc() ((void *)*(__seg_gs uintptr_t *)0x50)
#define _NtGetTls() ((void *)*(__seg_gs uintptr_t *)0x58)
#endif /* __GNUC__ && !__STRICT_ANSI__ */
#endif /* __GNUC__ */
#endif /* COSMOPOLITAN_LIBC_NT_TEB_H_ */

View file

@ -2,8 +2,7 @@
#define COSMOPOLITAN_LIBC_NT_THUNK_MSABI_H_
#ifdef __x86_64__
#if !defined(__STRICT_ANSI__) && \
(__GNUC__ * 100 + __GNUC_MINOR__ >= 408 || \
#if (__GNUC__ * 100 + __GNUC_MINOR__ >= 408 || \
(__has_attribute(__ms_abi__) || defined(__llvm__)))
/**
* Defines function as using Microsoft x64 calling convention.

View file

@ -8,13 +8,13 @@ bool32 GetVersionEx(struct NtOsVersionInfo *lpVersionInformation);
#if defined(__GNUC__) && !defined(__STRICT_ANSI__) && defined(__x86_64__)
#define IsAtLeastWindows10() (GetNtMajorVersion() >= 10)
#define GetNtMajorVersion() \
({ \
uintptr_t __x; \
asm("mov\t%%gs:96,%q0\r\n" \
"mov\t280(%q0),%b0" \
: "=q"(__x)); \
(unsigned char)__x; \
#define GetNtMajorVersion() \
__extension__({ \
uintptr_t __x; \
__asm__("mov\t%%gs:96,%q0\r\n" \
"mov\t280(%q0),%b0" \
: "=q"(__x)); \
(unsigned char)__x; \
})
#endif