Skip to content

Commit

Permalink
Merge pull request #271 from insertinterestingnamehere/stdint
Browse files Browse the repository at this point in the history
Use stdint.h directly instead of our old compat header.
  • Loading branch information
insertinterestingnamehere authored Sep 16, 2024
2 parents 8f430df + a0ee74e commit 78d3554
Show file tree
Hide file tree
Showing 38 changed files with 54 additions and 810 deletions.
747 changes: 0 additions & 747 deletions config/ax_create_stdint_h.m4

This file was deleted.

5 changes: 2 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -378,12 +378,12 @@ AC_ARG_ENABLE([lf-febs],
AC_ARG_WITH([cacheline-width],
[AS_HELP_STRING([--with-cacheline-width=bytes],
[Specify the cacheline width for the target
machine. Defaults to 64. Used only for optimizing
machine. Defaults to 256. Used only for optimizing
internal data structure layout;
qthread_cacheline() still detects this at
runtime.])],
[],
[with_cacheline_width=64])
[with_cacheline_width=256])

AC_ARG_ENABLE([multinode],
[AS_HELP_STRING([--enable-multinode],
Expand Down Expand Up @@ -587,7 +587,6 @@ AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_HEADER_TIME
AC_CHECK_HEADERS([stdlib.h fcntl.h ucontext.h sys/time.h sys/resource.h mach/mach_time.h malloc.h math.h sys/types.h sys/sysctl.h unistd.h sys/syscall.h])
AX_CREATE_STDINT_H([include/qthread/qthread-int.h])
AC_SYS_LARGEFILE

QTHREAD_CHECK_FUNCTION
Expand Down
3 changes: 1 addition & 2 deletions include/fastcontext/386-ucontext.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
#include <stdarg.h> /* for the qt_makectxt prototype */
#endif
#include <stddef.h> /* for size_t, per C89 */

#include "qthread-int.h"
#include <stdint.h>

#define setcontext(u) qt_setmctxt(&(u)->mc)
#define getcontext(u) qt_getmctxt(&(u)->mc)
Expand Down
3 changes: 1 addition & 2 deletions include/fastcontext/arm-ucontext.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
#endif

#include <stddef.h>

#include "qthread/qthread-int.h" /* for uint32_t */
#include <stdint.h>

#include "qt_visibility.h"

Expand Down
2 changes: 1 addition & 1 deletion include/qt_gcd.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "config.h"
#endif

#include "qthread-int.h"
#include <stdint.h>

static QINLINE size_t qt_gcd(size_t a, size_t b) {
#ifdef QTHREAD_SHIFT_GCD
Expand Down
3 changes: 1 addition & 2 deletions include/qt_hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
#endif

#include <stddef.h>

#include "qthread-int.h" /* for uintptr_t (standin for C99's stdint.h) */
#include <stdint.h>

#include "qt_visibility.h"

Expand Down
3 changes: 1 addition & 2 deletions include/qt_threadqueues.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#ifndef QT_THREADQUEUES_H
#define QT_THREADQUEUES_H
#include <stdint.h>

#include <sys/types.h> /* for ssize_t (according to P90) */

#include "qthread-int.h"

#include "qt_filters.h"
#include "qt_mpool.h"
#include "qt_qthread_t.h" /* for qthread_t */
Expand Down
1 change: 0 additions & 1 deletion include/qthread/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
common.h
qthread-int.h
stamp-h2
6 changes: 1 addition & 5 deletions include/qthread/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ pkginclude_HEADERS = \

# These headers are generated by ./configure
nodist_pkginclude_HEADERS = \
common.h \
qthread-int.h
common.h

# Installed here to keep it separate from the "real" omp_defines.h
noinst_HEADERS = \
Expand All @@ -47,9 +46,6 @@ pkginclude_HEADERS += \
spr.h
endif

distclean-local:
$(RM) -f qthread-int.h

# ensure that this happens after the rest of the uninstall is done
uninstall-hook:
test -d "$(pkgincludedir)" && rmdir $(pkgincludedir) || true
3 changes: 2 additions & 1 deletion include/qthread/qarray.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#ifndef QTHREAD_QARRAY_H
#define QTHREAD_QARRAY_H

#include <stdint.h>

#include "macros.h"
#include "qloop.h"
#include "qthread-int.h"

Q_STARTCXX /* */
typedef enum {
Expand Down
3 changes: 1 addition & 2 deletions include/qthread/qthread.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ using std::memory_order_relaxed;

#include <limits.h> /* for UINT_MAX (C89) */
#include <stdbool.h>

#include <stdint.h>
#include <string.h> /* for memcpy() */

#ifndef QTHREAD_NOALIGNCHECK
Expand All @@ -31,7 +31,6 @@ using std::memory_order_relaxed;
#endif

#include "common.h"
#include "qthread-int.h"

/*****************************************************************************
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Expand Down
4 changes: 2 additions & 2 deletions src/alloc/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
#include "config.h"
#endif

#include <stdint.h>
#include <stdlib.h>

/* System Headers */
#if (HAVE_MEMALIGN && HAVE_MALLOC_H)
#include <malloc.h> /* for memalign() */
Expand All @@ -13,8 +15,6 @@
static QINLINE int getpagesize() { return 4096; }
#endif

#include <qthread/qthread-int.h> /* for uintptr_t */

/* Internal Headers */
#include "qt_alloc.h"
#include "qt_asserts.h"
Expand Down
4 changes: 2 additions & 2 deletions src/alloc/chapel.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
#include "config.h"
#endif

#include <stdint.h>
#include <stdlib.h>

#ifdef HAVE_GETPAGESIZE
#include <unistd.h>
#else
static QINLINE int getpagesize() { return 4096; }
#endif

#include <qthread/qthread-int.h> /* for uint_fast16_t */

#include "chpl-linefile-support.h"
#include "chpl-mem.h"

Expand Down
4 changes: 1 addition & 3 deletions src/barrier/array.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
#endif

/* System Headers */

/* System Compatibility Header */
#include "qthread-int.h"
#include <stdint.h>

/* Installed Headers */
#include "qthread/barrier.h"
Expand Down
4 changes: 1 addition & 3 deletions src/barrier/feb.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@
#endif

/* System Headers */
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>

/* System Compatibility Header */
#include "qthread-int.h"

/* Public Headers */
#include "qthread/barrier.h"
#include "qthread/qthread.h"
Expand Down
4 changes: 1 addition & 3 deletions src/barrier/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@
// here and had no available F/E implementation - 12/17/09 akp

/* System Headers */
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>

/* System Compatibility Header */
#include "qthread-int.h"

/* Public Headers */
#include "qthread/barrier.h"
#include "qthread/qthread.h"
Expand Down
4 changes: 1 addition & 3 deletions src/barrier/sinc.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@
#endif

/* System Headers */
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>

/* System Compatibility Header */
#include "qthread-int.h"

/* Installed Headers */
#include "qthread/barrier.h"
#include "qthread/qthread.h"
Expand Down
3 changes: 1 addition & 2 deletions src/fastcontext/context.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@
#endif

#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h> /* for memmove(), per C89 */

#include "fastcontext/taskimpl.h"

#include <qthread-int.h>

#include "qthread/common.h"

#include "qt_asserts.h"
Expand Down
2 changes: 1 addition & 1 deletion src/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#endif

/* System Headers */
#include <qthread/qthread-int.h> /* for uint64_t */
#include <stdatomic.h>
#include <stdint.h>
#include <stdio.h> /* for fprintf() */
#include <stdlib.h> /* for abort() */
#include <sys/time.h> /* for gettimeofday() */
Expand Down
2 changes: 1 addition & 1 deletion src/mpool.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <pthread.h>

#include <stddef.h> /* for size_t (according to C89) */
#include <stdint.h>
#include <stdlib.h> /* for calloc() and malloc() */
#include <string.h>

Expand Down Expand Up @@ -34,7 +35,6 @@
#include "qt_mpool.h"
#include "qt_subsystems.h"
#include "qt_visibility.h"
#include <qthread/qthread-int.h> /* for uintptr_t */

/* Seems SLIGHTLY faster without TLS, and a whole lot safer and cleaner */
#ifdef TLS
Expand Down
2 changes: 1 addition & 1 deletion src/qthread.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
/* System Headers */
/******************************************************/
#include <limits.h> /* for INT_MAX */
#include <qthread/qthread-int.h> /* for UINT8_MAX */
#include <stdarg.h> /* for va_list, va_start() and va_end() */
#include <stdatomic.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h> /* for malloc() and abort() */
#include <string.h> /* for memset() */
Expand Down
3 changes: 2 additions & 1 deletion src/qtimer/gettime.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#include "config.h"
#endif

#include <stdint.h>

#if TIME_WITH_SYS_TIME
#include <sys/time.h>
#include <time.h>
Expand All @@ -17,7 +19,6 @@
#endif

#include <qthread/hash.h> /* for qt_hash64() */
#include <qthread/qthread-int.h> /* for uint64_t */
#include <qthread/qtimer.h>

#include "qt_alloc.h"
Expand Down
2 changes: 1 addition & 1 deletion src/qtimer/mach.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
#include "config.h"
#endif

#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>

#include <mach/mach_time.h>

#include "qt_alloc.h"
#include "qt_atomics.h" /* for SPINLOCK_BODY() */
#include "qthread-int.h"
#include "qthread/qthread.h" /* for aligned_t */
#include "qthread/qtimer.h"

Expand Down
2 changes: 1 addition & 1 deletion src/syncvar.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

/* System Headers */
#include <limits.h> /* for INT_MAX */
#include <qthread/qthread-int.h> /* for uint64_t */
#include <stdint.h>

/* API Headers */
#include "qthread/qthread.h"
Expand Down
4 changes: 2 additions & 2 deletions src/syscalls/accept.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
#include "config.h"
#endif

/* System Headers */
#include <qthread/qthread-int.h> /* for uint64_t */
#include <stdint.h>

/* System Headers */
#ifdef HAVE_SYS_SYSCALL_H
#include <sys/syscall.h> /* for SYS_accept and others */
#include <unistd.h>
Expand Down
4 changes: 2 additions & 2 deletions src/syscalls/connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
#include "config.h"
#endif

/* System Headers */
#include <qthread/qthread-int.h> /* for uint64_t */
#include <stdint.h>

/* System Headers */
#ifdef HAVE_SYS_SYSCALL_H
#include <sys/syscall.h> /* for SYS_accept and others */
#include <unistd.h>
Expand Down
2 changes: 1 addition & 1 deletion src/syscalls/nanosleep.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#endif

/* System Headers */
#include <stdint.h>
#include <time.h>

#ifdef HAVE_SYS_SYSCALL_H
Expand All @@ -11,7 +12,6 @@
#endif

/* API Headers */
#include "qthread/qthread-int.h"
#include "qthread/qthread.h"
#include "qthread/qtimer.h"

Expand Down
3 changes: 2 additions & 1 deletion src/syscalls/poll.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
#include "config.h"
#endif

#include <stdint.h>

#ifdef HAVE_SYS_SYSCALL_H
#include <sys/syscall.h> /* for SYS_accept and others */
#include <unistd.h>
#endif

/* Public Headers */
#include "qthread/qt_syscalls.h"
#include "qthread/qthread-int.h"

/* Internal Headers */
#include "qt_asserts.h"
Expand Down
3 changes: 2 additions & 1 deletion src/syscalls/pread.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#include "config.h"
#endif

#include <stdint.h>

/* System Headers */
#include <sys/types.h>

Expand All @@ -12,7 +14,6 @@

/* Public Headers */
#include "qthread/qt_syscalls.h"
#include "qthread/qthread-int.h"

/* Internal Headers */
#include "qt_asserts.h"
Expand Down
Loading

0 comments on commit 78d3554

Please sign in to comment.