This commit is contained in:
Alon Zakai 2015-09-22 15:06:18 -07:00
Родитель c64f1c95fc
Коммит 9cb9f34edd
12 изменённых файлов: 32 добавлений и 27 удалений

Просмотреть файл

@ -2,7 +2,7 @@
#include <stdio.h>
#include <stdlib.h>
func(int i) {
int func(int i) {
char *pc = (char *)alloca(100);
*pc = i;
(*pc)++;

Просмотреть файл

@ -13,17 +13,17 @@ int main() {
printf("%d*", atoi(" 3 7"));
printf("%d*", atoi("9 d"));
printf("%d\n", atoi(" 8 e"));
printf("%d*", atol(""));
printf("%d*", atol("a"));
printf("%d*", atol(" b"));
printf("%d*", atol(" c "));
printf("%d*", atol("6"));
printf("%d*", atol(" 5"));
printf("%d*", atol("4 "));
printf("%d*", atol("3 6"));
printf("%d*", atol(" 3 7"));
printf("%d*", atol("9 d"));
printf("%d\n", atol(" 8 e"));
printf("%d*", (int)atol(""));
printf("%d*", (int)atol("a"));
printf("%d*", (int)atol(" b"));
printf("%d*", (int)atol(" c "));
printf("%d*", (int)atol("6"));
printf("%d*", (int)atol(" 5"));
printf("%d*", (int)atol("4 "));
printf("%d*", (int)atol("3 6"));
printf("%d*", (int)atol(" 3 7"));
printf("%d*", (int)atol("9 d"));
printf("%d\n", (int)atol(" 8 e"));
printf("%lld*", atoll("6294967296"));
printf("%lld*", atoll(""));
printf("%lld*", atoll("a"));

Просмотреть файл

@ -4,7 +4,7 @@ uint64_t a, b;
int main(int argc, char *argv[]) {
a = argc;
b = argv[1][0];
printf("%d,%d\n", a, b);
printf("%d,%d\n", (int)a, (int)b);
if (a > a + b || a > a + b + 1) {
printf("one %lld, %lld", a, b);
return 0;

Просмотреть файл

@ -16,7 +16,7 @@ int64_t ccv_cache_generate_signature(char *msg, int len, int64_t sig_start,
}
int main(int argc, char **argv) {
argv[0] = "...";
argv[0] = (char*)"...";
for (int i = 0; i < argc; i++) {
int64_t x;
if (i % 123123 == 0)

Просмотреть файл

@ -22,7 +22,7 @@ int main()
{
printf("%f\n", __builtin_fabsf(negative10()));
printf("%f\n", __builtin_fabsf(positive42()));
printf("%f\n", __builtin_fabsf(negative_dbl_max()));
printf("%f\n", __builtin_fabsf((float)negative_dbl_max()));
printf("%f\n", __builtin_fabs(negative10()));
printf("%f\n", __builtin_fabs(positive42()));

Просмотреть файл

@ -3,7 +3,7 @@
int main() {
#define TEST(func) \
{ \
char *word = "WORD"; \
char *word = (char*)"WORD"; \
char wordEntry[2] = {-61, -126}; /* "Â"; */ \
int cmp = func(word, wordEntry, 2); \
printf("Compare value " #func " is %d\n", cmp); \

Просмотреть файл

@ -37,7 +37,7 @@ int main() {
isprint,
isgraph
};
char* funcNames[] = {
const char* funcNames[] = {
"isascii",
"islower",
"isupper",

Просмотреть файл

@ -3,7 +3,7 @@
#ifndef REPORT_RESULT
// To be able to run this test outside the browser harness in node.js/spidermonkey:
#define REPORT_RESULT int dummy
#define REPORT_RESULT()
#endif
int result = 0;

Просмотреть файл

@ -89,7 +89,7 @@ main( int argc,
}
// Only test the character 'w'
text = "w";
text = (char*)"w";
filename = argv[1]; /* first argument */
WIDTH = atoi(argv[3]);
@ -132,4 +132,4 @@ main( int argc,
return 0;
}
/* EOF */
/* EOF */

Просмотреть файл

@ -1,5 +1,6 @@
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <emscripten.h>
int main() {

Просмотреть файл

@ -53,7 +53,7 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co
long long x = 0x0000def123450789ULL; // any bigger than this, and we
long long y = 0x00020ef123456089ULL; // start to run into the double precision limit!
printf("*%lld,%lld,%lld,%lld,%lld*\\n", x, y, x | y, x & y, x ^ y, x >> 2, y << 2);
printf("*%lld,%lld,%lld,%lld,%lld*\\n", x, y, x | y, x & y, x ^ y);
printf("*");
long long z = 13;
@ -1548,7 +1548,7 @@ int main () {
try
{
Polymorphic * pb = 0;
typeid(*pb); // throws a bad_typeid exception
const std::type_info& ti = typeid(*pb); // throws a bad_typeid exception
}
catch (std::exception& e)
{
@ -2173,7 +2173,7 @@ int main() {
int main(int argc, char **argv)
{
char *buf1 = (char*)malloc(100);
char *data1 = "hello";
char *data1 = (char*)"hello";
memcpy(buf1, data1, strlen(data1)+1);
float *buf2 = (float*)malloc(100);
@ -2185,7 +2185,7 @@ int main() {
int totalMemory = emscripten_run_script_int("TOTAL_MEMORY");
char *buf3 = (char*)malloc(totalMemory+1);
buf3[argc] = (int)buf2;
if (argc % 7 == 6) printf("%d\n", memcpy(buf3, buf1, argc));
if (argc % 7 == 6) printf("%d\n", (int)memcpy(buf3, buf1, argc));
char *buf4 = (char*)malloc(100);
float *buf5 = (float*)malloc(100);
//printf("totalMemory: %d bufs: %d,%d,%d,%d,%d\n", totalMemory, buf1, buf2, buf3, buf4, buf5);
@ -5534,7 +5534,7 @@ struct one_const addr_of_my_consts = {
};
int main(void) {
printf("%li\n", !!addr_of_my_consts.a);
printf("%li\n", (long)!!addr_of_my_consts.a);
return 0;
}
''', '1')
@ -5607,8 +5607,10 @@ int main(void) {
def test_dlmalloc_partial(self):
# present part of the symbols of dlmalloc, not all
src = open(path_from_root('tests', 'new.cpp')).read().replace('{{{ NEW }}}', 'new int').replace('{{{ DELETE }}}', 'delete') + '''
#include <new>
void *
operator new(size_t size)
operator new(size_t size) throw(std::bad_alloc)
{
printf("new %d!\\n", size);
return malloc(size);
@ -7746,6 +7748,8 @@ def make_run(fullname, name=-1, compiler=-1, embetter=0, quantum_size=0,
Settings.load(self.emcc_args)
Building.LLVM_OPTS = 0
Building.COMPILER_TEST_OPTS += ['-Wno-dynamic-class-memaccess', '-Wno-format', '-Wno-format-extra-args', '-Wno-format-security', '-Wno-pointer-bool-conversion', '-Wno-unused-volatile-lvalue', '-Wno-c++11-compat-deprecated-writable-strings', '-Wno-invalid-pp-token']
for arg in self.emcc_args:
if arg.startswith('-O'):
Building.COMPILER_TEST_OPTS.append(arg) # so bitcode is optimized too, this is for cpp to ll

Просмотреть файл

@ -119,7 +119,7 @@ class TypeTestClass {
unsigned short int ReturnUnsignedShortMethod() { return (2<<15)-1; }
void AcceptUnsignedShortMethod(unsigned short x) { printf("unsigned short int: %u\n", x); }
unsigned long ReturnUnsignedLongMethod() { return (2<<31)-1; }
unsigned long ReturnUnsignedLongMethod() { return 0xffffffff; }
void AcceptUnsignedLongMethod(unsigned long x) { printf("unsigned long int: %u\n", x); }
};