Skip to content

Commit

Permalink
Run V7 tests with -Wundef
Browse files Browse the repository at this point in the history
PUBLISHED_FROM=e2375c5b10be12a75f6a5f9df56ebe9f5faa9331
  • Loading branch information
Deomid Ryabkov authored and cesantabot committed Oct 13, 2016
1 parent cbac1f8 commit 883bfda
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 8 deletions.
10 changes: 7 additions & 3 deletions tests/unit_test.c
Expand Up @@ -79,6 +79,10 @@ extern long timezone;
#define MAX_ECMA_REPORT_LINES 100000
#define ECMA_WORKER_THREADS 4

#ifndef V7_VERBOSE_ECMA
#define V7_VERBOSE_ECMA 0
#endif

struct ecma_test {
int index;
const char *driver;
Expand Down Expand Up @@ -2181,7 +2185,7 @@ static const char *test_to_json(void) {
eval(v7, "123.45", &v);
ASSERT((p = v7_to_json(v7, v, buf, sizeof(buf))) == buf);
ASSERT_STREQ(p, c);
#if TODO
#if 0 /* TODO */
eval(v7, "({a: new Number(123.45)})", &v);
ASSERT((p = v7_to_json(v7, v, buf, sizeof(buf))) == buf);
ASSERT_STREQ(p, c);
Expand All @@ -2194,7 +2198,7 @@ static const char *test_to_json(void) {
eval(v7, "'foo'", &v);
ASSERT((p = v7_to_json(v7, v, buf, sizeof(buf))) == buf);
ASSERT_STREQ(p, c);
#if TODO
#if 0 /* TODO */
eval(v7, "new String('foo')", &v);
ASSERT((p = v7_to_json(v7, v, buf, sizeof(buf))) == buf);
ASSERT_STREQ(p, c);
Expand Down Expand Up @@ -2222,7 +2226,7 @@ static const char *test_to_json(void) {
eval(v7, "({a: true})", &v);
ASSERT((p = v7_to_json(v7, v, buf, sizeof(buf))) == buf);
ASSERT_STREQ(p, c);
#if TODO
#if 0 /* TODO */
eval(v7, "({a: new Boolean(true)})", &v);
ASSERT((p = v7_to_json(v7, v, buf, sizeof(buf))) == buf);
ASSERT_STREQ(p, c);
Expand Down
51 changes: 48 additions & 3 deletions v7.c
Expand Up @@ -1086,6 +1086,33 @@ void cs_to_hex(char *to, const unsigned char *p, size_t len);

#endif /* CS_COMMON_MD5_H_ */
#ifdef V7_MODULE_LINES
#line 1 "common/cs_endian.h"
#endif
/*
* Copyright (c) 2014-2016 Cesanta Software Limited
* All rights reserved
*/

#ifndef CS_COMMON_CS_ENDIAN_H_
#define CS_COMMON_CS_ENDIAN_H_

/*
* clang with std=-c99 uses __LITTLE_ENDIAN, by default
* while for ex, RTOS gcc - LITTLE_ENDIAN, by default
* it depends on __USE_BSD, but let's have everything
*/
#if !defined(BYTE_ORDER) && defined(__BYTE_ORDER)
#define BYTE_ORDER __BYTE_ORDER
#ifndef LITTLE_ENDIAN
#define LITTLE_ENDIAN __LITTLE_ENDIAN
#endif /* LITTLE_ENDIAN */
#ifndef BIG_ENDIAN
#define BIG_ENDIAN __LITTLE_ENDIAN
#endif /* BIG_ENDIAN */
#endif /* BYTE_ORDER */

#endif /* CS_COMMON_CS_ENDIAN_H_ */
#ifdef V7_MODULE_LINES
#line 1 "common/sha1.h"
#endif
/*
Expand Down Expand Up @@ -2190,8 +2217,6 @@ void cr_context_free(struct cr_ctx *p_ctx);
#define V7_ENABLE__String__localeUpperCase 0
#endif



#endif /* CS_V7_SRC_FEATURES_ALL_H_ */
#ifdef V7_MODULE_LINES
#line 1 "v7/src/v7_features.h"
Expand All @@ -2211,6 +2236,10 @@ void cr_context_free(struct cr_ctx *p_ctx);
/* All the features will be default-defined to 0. */
/* Amalgamated: #include "v7/src/features_all.h" */

#ifndef V7_DISABLE_AST_TAG_NAMES
#define V7_DISABLE_AST_TAG_NAMES 0
#endif

#ifndef V7_DISABLE_GC
#define V7_DISABLE_GC 0
#endif
Expand Down Expand Up @@ -2243,6 +2272,14 @@ void cr_context_free(struct cr_ctx *p_ctx);
#define V7_ENABLE_DENSE_ARRAYS 0
#endif

#ifndef V7_ENABLE_ENTITY_IDS
#define V7_ENABLE_ENTITY_IDS 0
#endif

#ifndef V7_ENABLE_FILE
#define V7_ENABLE_FILE 0
#endif

#ifndef V7_ENABLE_FOOTPRINT_REPORT
#define V7_ENABLE_FOOTPRINT_REPORT 0
#endif
Expand Down Expand Up @@ -9678,6 +9715,8 @@ int cs_base64_decode(const unsigned char *s, int len, char *dst) {

#if !DISABLE_MD5 && !defined(EXCLUDE_COMMON)

/* Amalgamated: #include "common/cs_endian.h" */

static void byteReverse(unsigned char *buf, unsigned longs) {
/* Forrest: MD5 expect LITTLE_ENDIAN, swap if BIG_ENDIAN */
#if BYTE_ORDER == BIG_ENDIAN
Expand Down Expand Up @@ -9905,9 +9944,11 @@ char *cs_md5(char buf[33], ...) {
/* Copyright(c) By Steve Reid <steve@edmweb.com> */
/* 100% Public Domain */

/* Amalgamated: #include "common/sha1.h" */

#if !DISABLE_SHA1 && !defined(EXCLUDE_COMMON)

/* Amalgamated: #include "common/sha1.h" */
/* Amalgamated: #include "common/cs_endian.h" */

#define SHA1HANDSOFF
#if defined(__sun)
Expand Down Expand Up @@ -10731,6 +10772,8 @@ void cr_context_free(struct cr_ctx *p_ctx) {
* All rights reserved
*/

/* Amalgamated: #include "common/platform.h" */

#if CS_PLATFORM == CS_P_MBED

long timezone;
Expand Down Expand Up @@ -28725,6 +28768,8 @@ int main(int argc, char **argv) {
#include <stdio.h>
#include <assert.h>

/* Amalgamated: #include "v7/src/internal.h" */

#if V7_HEAPUSAGE_ENABLE

/*
Expand Down
14 changes: 12 additions & 2 deletions v7.h
Expand Up @@ -408,8 +408,6 @@
#define V7_ENABLE__String__localeUpperCase 0
#endif



#endif /* CS_V7_SRC_FEATURES_ALL_H_ */
#ifdef V7_MODULE_LINES
#line 1 "v7/src/v7_features.h"
Expand All @@ -429,6 +427,10 @@
/* All the features will be default-defined to 0. */
/* Amalgamated: #include "v7/src/features_all.h" */

#ifndef V7_DISABLE_AST_TAG_NAMES
#define V7_DISABLE_AST_TAG_NAMES 0
#endif

#ifndef V7_DISABLE_GC
#define V7_DISABLE_GC 0
#endif
Expand Down Expand Up @@ -461,6 +463,14 @@
#define V7_ENABLE_DENSE_ARRAYS 0
#endif

#ifndef V7_ENABLE_ENTITY_IDS
#define V7_ENABLE_ENTITY_IDS 0
#endif

#ifndef V7_ENABLE_FILE
#define V7_ENABLE_FILE 0
#endif

#ifndef V7_ENABLE_FOOTPRINT_REPORT
#define V7_ENABLE_FOOTPRINT_REPORT 0
#endif
Expand Down

0 comments on commit 883bfda

Please sign in to comment.