Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Eliminate C-style array declarations.
Browse files Browse the repository at this point in the history
  • Loading branch information
H. S. Teoh committed Aug 30, 2014
1 parent 52617d5 commit a2afe11
Show file tree
Hide file tree
Showing 20 changed files with 69 additions and 69 deletions.
4 changes: 2 additions & 2 deletions src/core/bitop.d
Expand Up @@ -89,7 +89,7 @@ int bt(in size_t* p, size_t bitnum) pure @system
///
@system pure unittest
{
size_t array[2];
size_t[2] array;

array[0] = 2;
array[1] = 0x100;
Expand Down Expand Up @@ -129,7 +129,7 @@ int bts(size_t* p, size_t bitnum) pure @system;
///
@system pure unittest
{
size_t array[2];
size_t[2] array;

array[0] = 2;
array[1] = 0x100;
Expand Down
2 changes: 1 addition & 1 deletion src/core/demangle.d
Expand Up @@ -231,7 +231,7 @@ private struct Demangle

char[] putAsHex( size_t val, int width = 0 )
{
char tmp[20];
char[20] tmp;
int pos = tmp.length;

while( val )
Expand Down
6 changes: 3 additions & 3 deletions src/core/stdc/stdio.d
Expand Up @@ -844,9 +844,9 @@ version(CRuntime_DigitalMars)
private enum _MAX_SEMAPHORES = 10 + _NFILE;
private enum _semIO = 3;

private extern __gshared short _iSemLockCtrs[_MAX_SEMAPHORES];
private extern __gshared int _iSemThreadIds[_MAX_SEMAPHORES];
private extern __gshared int _iSemNestCount[_MAX_SEMAPHORES];
private extern __gshared short[_MAX_SEMAPHORES] _iSemLockCtrs;
private extern __gshared int[_MAX_SEMAPHORES] _iSemThreadIds;
private extern __gshared int[_MAX_SEMAPHORES] _iSemNestCount;
private extern __gshared HANDLE[_NFILE] _osfhnd;
private extern __gshared ubyte[_NFILE] __fhnd_info;

Expand Down
2 changes: 1 addition & 1 deletion src/core/sys/freebsd/dlfcn.d
Expand Up @@ -81,7 +81,7 @@ static if (__BSD_VISIBLE)
struct Dl_serinfo {
size_t dls_size; /* total buffer size */
uint dls_cnt; /* number of path entries */
Dl_serpath dls_serpath[1]; /* there may be more than one */
Dl_serpath[1] dls_serpath; /* there may be more than one */
};
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/sys/freebsd/sys/elf32.d
Expand Up @@ -25,7 +25,7 @@ alias Elf32_Sword Elf32_Ssize;

struct Elf32_Ehdr
{
char e_ident[EI_NIDENT];
char[EI_NIDENT] e_ident;
Elf32_Half e_type;
Elf32_Half e_machine;
Elf32_Word e_version;
Expand Down
2 changes: 1 addition & 1 deletion src/core/sys/freebsd/sys/elf64.d
Expand Up @@ -27,7 +27,7 @@ alias Elf64_Sxword Elf64_Ssize;

struct Elf64_Ehdr
{
char e_ident[EI_NIDENT];
char[EI_NIDENT] e_ident;
Elf64_Half e_type;
Elf64_Half e_machine;
Elf64_Word e_version;
Expand Down
6 changes: 3 additions & 3 deletions src/core/sys/linux/elf.d
Expand Up @@ -42,7 +42,7 @@ enum EI_NIDENT = 16;

struct Elf32_Ehdr
{
char e_ident[EI_NIDENT];
char[EI_NIDENT] e_ident;
Elf32_Half e_type;
Elf32_Half e_machine;
Elf32_Word e_version;
Expand All @@ -60,7 +60,7 @@ struct Elf32_Ehdr

struct Elf64_Ehdr
{
char e_ident[EI_NIDENT];
char[EI_NIDENT] e_ident;
Elf64_Half e_type;
Elf64_Half e_machine;
Elf64_Word e_version;
Expand Down Expand Up @@ -1192,7 +1192,7 @@ union Elf32_gptab
struct Elf32_RegInfo
{
Elf32_Word ri_gprmask;
Elf32_Word ri_cprmask[4];
Elf32_Word[4] ri_cprmask;
Elf32_Sword ri_gp_value;
}

Expand Down
14 changes: 7 additions & 7 deletions src/core/sys/posix/setjmp.d
Expand Up @@ -82,23 +82,23 @@ version( linux )
{
void * __pc;
void * __sp;
int __regs[8];
int[8] __regs;
void * __fp;
void * __gp;
}
else
{
long __pc;
long __sp;
long __regs[8];
long[8] __regs;
long __fp;
long __gp;
}
int __fpc_csr;
version (MIPS_N64)
double __fpregs[8];
double[8] __fpregs;
else
double __fpregs[6];
double[6] __fpregs;
}
}
else version (MIPS64)
Expand All @@ -107,14 +107,14 @@ version( linux )
{
long __pc;
long __sp;
long __regs[8];
long[8] __regs;
long __fp;
long __gp;
int __fpc_csr;
version (MIPS_N64)
double __fpregs[8];
double[8] __fpregs;
else
double __fpregs[6];
double[6] __fpregs;
}
}
else
Expand Down
16 changes: 8 additions & 8 deletions src/core/sys/posix/signal.d
Expand Up @@ -611,7 +611,7 @@ version( linux )

union _sifields_t
{
int _pad[__SI_PAD_SIZE];
int[__SI_PAD_SIZE] _pad;

// kill()
struct _kill_t
Expand Down Expand Up @@ -725,7 +725,7 @@ else version( OSX )
void* si_addr;
sigval si_value;
int si_band;
uint pad[7];
uint[7] pad;
}

enum SI_USER = 0x10001;
Expand All @@ -750,7 +750,7 @@ else version( FreeBSD )
{
struct sigset_t
{
uint __bits[4];
uint[4] __bits;
}

struct siginfo_t
Expand Down Expand Up @@ -816,7 +816,7 @@ else version (Solaris)

struct sigset_t
{
uint __bits[4];
uint[4] __bits;
}

struct siginfo_t
Expand All @@ -831,9 +831,9 @@ else version (Solaris)
union ___data
{
version (D_LP64)
int si_pad[(256 / int.sizeof) - 4];
int[(256 / int.sizeof) - 4] si_pad;
else
int si_pad[(128 / int.sizeof) - 3];
int[(128 / int.sizeof) - 3] si_pad;

struct ___proc
{
Expand Down Expand Up @@ -890,8 +890,8 @@ else version (Solaris)
short __syscall;
char __nsysarg;
char __fault;
c_long __sysarg[8];
int __mstate[10];
c_long[8] __sysarg;
int[10] __mstate;
}

___prof __prof;
Expand Down
2 changes: 1 addition & 1 deletion src/core/sys/posix/sys/select.d
Expand Up @@ -181,7 +181,7 @@ else version( FreeBSD )

struct fd_set
{
__fd_mask __fds_bits[(FD_SETSIZE + (_NFDBITS - 1)) / _NFDBITS];
__fd_mask[(FD_SETSIZE + (_NFDBITS - 1)) / _NFDBITS] __fds_bits;
}

extern (D) __fd_mask __fdset_mask(uint n)
Expand Down
4 changes: 2 additions & 2 deletions src/core/sys/posix/sys/stat.d
Expand Up @@ -172,7 +172,7 @@ version( linux )
time_t st_ctime;
ulong_t st_ctimensec;
}
slong_t __unused[3];
slong_t[3] __unused;
}
}
else version (MIPS_O32)
Expand Down Expand Up @@ -613,7 +613,7 @@ else version( OSX )
uint st_flags;
uint st_gen;
int st_lspare;
long st_qspare[2];
long[2] st_qspare;
}

enum S_IRUSR = 0x100; // octal 0400
Expand Down
2 changes: 1 addition & 1 deletion src/core/sys/posix/sys/statvfs.d
Expand Up @@ -37,7 +37,7 @@ version(linux) {
}
c_ulong f_flag;
c_ulong f_namemax;
int __f_spare[6];
int[6] __f_spare;
}
/* Definitions for the flag in `f_flag'. These definitions should be
kept in sync with the definitions in <sys/mount.h>. */
Expand Down
18 changes: 9 additions & 9 deletions src/core/sys/posix/sys/types.d
Expand Up @@ -477,7 +477,7 @@ version (linux)

union pthread_attr_t
{
byte __size[__SIZEOF_PTHREAD_ATTR_T];
byte[__SIZEOF_PTHREAD_ATTR_T] __size;
c_long __align;
}

Expand All @@ -493,41 +493,41 @@ version (linux)

union pthread_cond_t
{
byte __size[__SIZEOF_PTHREAD_COND_T];
byte[__SIZEOF_PTHREAD_COND_T] __size;
long __align;
}

union pthread_condattr_t
{
byte __size[__SIZEOF_PTHREAD_CONDATTR_T];
byte[__SIZEOF_PTHREAD_CONDATTR_T] __size;
int __align;
}

alias uint pthread_key_t;

union pthread_mutex_t
{
byte __size[__SIZEOF_PTHREAD_MUTEX_T];
byte[__SIZEOF_PTHREAD_MUTEX_T] __size;
c_long __align;
}

union pthread_mutexattr_t
{
byte __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
byte[__SIZEOF_PTHREAD_MUTEXATTR_T] __size;
int __align;
}

alias int pthread_once_t;

struct pthread_rwlock_t
{
byte __size[__SIZEOF_PTHREAD_RWLOCK_T];
byte[__SIZEOF_PTHREAD_RWLOCK_T] __size;
c_long __align;
}

struct pthread_rwlockattr_t
{
byte __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];
byte[__SIZEOF_PTHREAD_RWLOCKATTR_T] __size;
c_long __align;
}

Expand Down Expand Up @@ -797,13 +797,13 @@ version( linux )
{
struct pthread_barrier_t
{
byte __size[__SIZEOF_PTHREAD_BARRIER_T];
byte[__SIZEOF_PTHREAD_BARRIER_T] __size;
c_long __align;
}

struct pthread_barrierattr_t
{
byte __size[__SIZEOF_PTHREAD_BARRIERATTR_T];
byte[__SIZEOF_PTHREAD_BARRIERATTR_T] __size;
int __align;
}
}
Expand Down
32 changes: 16 additions & 16 deletions src/core/sys/posix/sys/utsname.d
Expand Up @@ -10,14 +10,14 @@ extern (C)

struct utsname
{
char sysname[utsNameLength];
char nodename[utsNameLength];
char release[utsNameLength];
char[utsNameLength] sysname;
char[utsNameLength] nodename;
char[utsNameLength] release;
// The field name is version but version is a keyword in D.
char update[utsNameLength];
char machine[utsNameLength];
char[utsNameLength] update;
char[utsNameLength] machine;

char __domainname[utsNameLength];
char[utsNameLength] __domainname;
}

int uname(utsname* __name);
Expand All @@ -28,12 +28,12 @@ extern (C)

struct utsname
{
char sysname[utsNameLength];
char nodename[utsNameLength];
char release[utsNameLength];
char[utsNameLength] sysname;
char[utsNameLength] nodename;
char[utsNameLength] release;
// The field name is version but version is a keyword in D.
char update[utsNameLength];
char machine[utsNameLength];
char[utsNameLength] update;
char[utsNameLength] machine;
}

int uname(utsname* __name);
Expand All @@ -44,12 +44,12 @@ extern (C)

struct utsname
{
char sysname[utsNameLength];
char nodename[utsNameLength];
char release[utsNameLength];
char[utsNameLength] sysname;
char[utsNameLength] nodename;
char[utsNameLength] release;
// The field name is version but version is a keyword in D.
char update[utsNameLength];
char machine[utsNameLength];
char[utsNameLength] update;
char[utsNameLength] machine;
}

int uname(utsname* __name);
Expand Down
8 changes: 4 additions & 4 deletions src/core/sys/posix/ucontext.d
Expand Up @@ -523,12 +523,12 @@ version( linux )
struct sigcontext {
ulong fault_address;
/* AArch64 registers */
ulong regs[31];
ulong[31] regs;
ulong sp;
ulong pc;
ulong pstate;
/* 4K reserved for FP/SIMD state and future expansion */
align(16) ubyte __reserved[4096];
align(16) ubyte[4096] __reserved;
}

alias sigcontext mcontext_t;
Expand Down Expand Up @@ -591,12 +591,12 @@ else version( FreeBSD )
long mc_ownedfp;

align(16)
long mc_fpstate[64];
long[64] mc_fpstate;

__register_t mc_fsbase;
__register_t mc_gsbase;

long mc_spare[6];
long[6] mc_spare;
}
}
else version( X86 )
Expand Down

0 comments on commit a2afe11

Please sign in to comment.