From 55471a9330c1fb7bb808c0f597ae5299dc7de8fb Mon Sep 17 00:00:00 2001 From: Jack Stouffer Date: Wed, 11 Jan 2017 14:32:00 +0000 Subject: [PATCH 1/2] Revert "Qualify C-style memory allocations functions as pure" This reverts commit 65d9a071b244611ca3973d79c8e64388af5c5439. --- src/core/stdc/stdlib.d | 11 ++++++----- src/core/sys/posix/stdlib.d | 12 ++++++------ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/core/stdc/stdlib.d b/src/core/stdc/stdlib.d index 6fe432aace..86cbafb5ed 100644 --- a/src/core/stdc/stdlib.d +++ b/src/core/stdc/stdlib.d @@ -157,11 +157,11 @@ else // functions using these already have to be @trusted, allowing them to // call @system stuff anyway. /// -void* malloc(size_t size) pure; +void* malloc(size_t size); /// -void* calloc(size_t nmemb, size_t size) pure; +void* calloc(size_t nmemb, size_t size); /// -void* realloc(void* ptr, size_t size) pure; +void* realloc(void* ptr, size_t size); /// void free(void* ptr); @@ -212,11 +212,11 @@ size_t wcstombs(char* s, in wchar_t* pwcs, size_t n); version( DigitalMars ) { // See malloc comment about @trusted. - void* alloca(size_t size) pure; // non-standard + void* alloca(size_t size); // non-standard } else version( GNU ) { - void* alloca(size_t size) pure; // compiler intrinsic + void* alloca(size_t size); // compiler intrinsic } version( CRuntime_Microsoft ) @@ -231,3 +231,4 @@ version( CRuntime_Microsoft ) /// long _wcstoi64(in wchar *,wchar **,int); } + diff --git a/src/core/sys/posix/stdlib.d b/src/core/sys/posix/stdlib.d index c9450a8412..4afd346d46 100644 --- a/src/core/sys/posix/stdlib.d +++ b/src/core/sys/posix/stdlib.d @@ -122,42 +122,42 @@ version( CRuntime_Glibc ) int setenv(in char*, in char*, int); int unsetenv(in char*); - void* valloc(size_t) pure; // LEGACY non-standard + void* valloc(size_t); // LEGACY non-standard } else version( Darwin ) { int setenv(in char*, in char*, int); int unsetenv(in char*); - void* valloc(size_t) pure; // LEGACY non-standard + void* valloc(size_t); // LEGACY non-standard } else version( FreeBSD ) { int setenv(in char*, in char*, int); int unsetenv(in char*); - void* valloc(size_t) pure; // LEGACY non-standard + void* valloc(size_t); // LEGACY non-standard } else version( OpenBSD ) { int setenv(in char*, in char*, int); int unsetenv(in char*); - void* valloc(size_t) pure; // LEGACY non-standard + void* valloc(size_t); // LEGACY non-standard } else version( CRuntime_Bionic ) { int setenv(in char*, in char*, int); int unsetenv(in char*); - void* valloc(size_t) pure; + void* valloc(size_t); } else version( Solaris ) { int setenv(in char*, in char*, int); int unsetenv(in char*); - void* valloc(size_t) pure; // LEGACY non-standard + void* valloc(size_t); // LEGACY non-standard } // From 64170f235abc33846f529c1907165ef8cd21d8e3 Mon Sep 17 00:00:00 2001 From: Jack Stouffer Date: Sat, 14 Jan 2017 16:24:42 -0500 Subject: [PATCH 2/2] Added pure back to alloca --- src/core/stdc/stdlib.d | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/core/stdc/stdlib.d b/src/core/stdc/stdlib.d index 86cbafb5ed..9348c7d107 100644 --- a/src/core/stdc/stdlib.d +++ b/src/core/stdc/stdlib.d @@ -212,11 +212,11 @@ size_t wcstombs(char* s, in wchar_t* pwcs, size_t n); version( DigitalMars ) { // See malloc comment about @trusted. - void* alloca(size_t size); // non-standard + void* alloca(size_t size) pure; // non-standard } else version( GNU ) { - void* alloca(size_t size); // compiler intrinsic + void* alloca(size_t size) pure; // compiler intrinsic } version( CRuntime_Microsoft ) @@ -231,4 +231,3 @@ version( CRuntime_Microsoft ) /// long _wcstoi64(in wchar *,wchar **,int); } -