Skip to content

Warning fixes. #885

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 16, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,8 @@ project (Jerry C ASM)
endforeach()
endmacro()

add_jerry_compile_warnings(all extra format-nonliteral init-self conversion sign-conversion format-security missing-declarations)
add_jerry_compile_flags(-pedantic -Wno-stack-protector -Wno-attributes)
add_jerry_compile_warnings(all extra format-nonliteral init-self conversion sign-conversion format-security missing-declarations pedantic)
add_jerry_compile_flags(-Wno-stack-protector -Wno-attributes)
if(CMAKE_COMPILER_IS_GNUCC)
add_jerry_compile_warnings(logical-op)
else()
Expand Down
18 changes: 9 additions & 9 deletions jerry-core/ecma/base/ecma-globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,8 @@ typedef enum
*/
typedef struct
{
mem_cpointer_t getter_p : ECMA_POINTER_FIELD_WIDTH; /**< pointer to getter object */
mem_cpointer_t setter_p : ECMA_POINTER_FIELD_WIDTH; /**< pointer to setter object */
__extension__ mem_cpointer_t getter_p : ECMA_POINTER_FIELD_WIDTH; /**< pointer to getter object */
__extension__ mem_cpointer_t setter_p : ECMA_POINTER_FIELD_WIDTH; /**< pointer to setter object */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this working on other compilers not just GCC? On the long run perhaps an unsigned int will also do.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The following could work somewhere in jrt.h where the attributes are defined.

#ifndef __GNUC__
#define __extension__
#endif

But do note that right now we have no compiler specific ifdefs in the core code base.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good to me, thanks, I'll define this __ extension __.

} ecma_getter_setter_pointers_t;

/**
Expand All @@ -307,7 +307,7 @@ typedef struct __attr_packed___ ecma_property_t
unsigned int type : 2;

/** Compressed pointer to next property */
mem_cpointer_t next_property_p : ECMA_POINTER_FIELD_WIDTH;
__extension__ mem_cpointer_t next_property_p : ECMA_POINTER_FIELD_WIDTH;

/** Property's details (depending on Type) */
union
Expand All @@ -316,10 +316,10 @@ typedef struct __attr_packed___ ecma_property_t
struct __attr_packed___ ecma_named_data_property_t
{
/** Value */
ecma_value_t value : ECMA_VALUE_SIZE;
__extension__ ecma_value_t value : ECMA_VALUE_SIZE;

/** Compressed pointer to property's name (pointer to String) */
mem_cpointer_t name_p : ECMA_POINTER_FIELD_WIDTH;
__extension__ mem_cpointer_t name_p : ECMA_POINTER_FIELD_WIDTH;

/** Flag indicating whether the property is registered in LCache */
unsigned int is_lcached : 1;
Expand All @@ -338,7 +338,7 @@ typedef struct __attr_packed___ ecma_property_t
struct __attr_packed___ ecma_named_accessor_property_t
{
/** Compressed pointer to property's name (pointer to String) */
mem_cpointer_t name_p : ECMA_POINTER_FIELD_WIDTH;
__extension__ mem_cpointer_t name_p : ECMA_POINTER_FIELD_WIDTH;

/** Attribute 'Enumerable' (ecma_property_enumerable_value_t) */
unsigned int enumerable : 1;
Expand All @@ -350,7 +350,7 @@ typedef struct __attr_packed___ ecma_property_t
unsigned int is_lcached : 1;

/** Compressed pointer to pair of pointers - to property's getter and setter */
mem_cpointer_t getter_setter_pair_cp : ECMA_POINTER_FIELD_WIDTH;
__extension__ mem_cpointer_t getter_setter_pair_cp : ECMA_POINTER_FIELD_WIDTH;
} named_accessor_property;

/** Description of internal property */
Expand Down Expand Up @@ -795,10 +795,10 @@ typedef struct ecma_string_t
lit_cpointer_t lit_cp;

/** Compressed pointer to an ecma_collection_header_t */
mem_cpointer_t collection_cp : ECMA_POINTER_FIELD_WIDTH;
__extension__ mem_cpointer_t collection_cp : ECMA_POINTER_FIELD_WIDTH;

/** Compressed pointer to an ecma_number_t */
mem_cpointer_t number_cp : ECMA_POINTER_FIELD_WIDTH;
__extension__ mem_cpointer_t number_cp : ECMA_POINTER_FIELD_WIDTH;

/** UInt32-represented number placed locally in the descriptor */
uint32_t uint32_number;
Expand Down
2 changes: 1 addition & 1 deletion jerry-core/ecma/base/ecma-helpers-string.c
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,7 @@ ecma_compare_ecma_strings_longpath (const ecma_string_t *string1_p, /* ecma-stri
{
case ECMA_STRING_CONTAINER_LIT_TABLE:
{
JERRY_ASSERT (string1_p->u.lit_cp.packed_value != string2_p->u.lit_cp.packed_value);
JERRY_ASSERT (string1_p->u.lit_cp.u.packed_value != string2_p->u.lit_cp.u.packed_value);
return false;
}
case ECMA_STRING_CONTAINER_MAGIC_STRING:
Expand Down
2 changes: 1 addition & 1 deletion jerry-core/ecma/base/ecma-helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -1388,7 +1388,7 @@ ecma_bytecode_deref (ecma_compiled_code_t *bytecode_p) /**< byte code pointer */

for (uint32_t i = const_literal_end; i < literal_end; i++)
{
mem_cpointer_t bytecode_cpointer = literal_start_p[i].value.base_cp;
mem_cpointer_t bytecode_cpointer = literal_start_p[i].u.value.base_cp;
ecma_compiled_code_t *bytecode_literal_p = ECMA_GET_NON_NULL_POINTER (ecma_compiled_code_t,
bytecode_cpointer);

Expand Down
2 changes: 1 addition & 1 deletion jerry-core/ecma/operations/ecma-objects-arguments.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ ecma_op_create_arguments_object (ecma_object_t *func_obj_p, /**< callee function
indx++)
{
// i.
if (literal_p[indx].packed_value == MEM_CP_NULL)
if (literal_p[indx].u.packed_value == MEM_CP_NULL)
{
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion jerry-core/ecma/operations/ecma-reference.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ typedef struct
ecma_value_t base;

/** referenced name */
mem_cpointer_t referenced_name_cp : ECMA_POINTER_FIELD_WIDTH;
__extension__ mem_cpointer_t referenced_name_cp : ECMA_POINTER_FIELD_WIDTH;

/** strict reference flag */
unsigned int is_strict : 1;
Expand Down
10 changes: 4 additions & 6 deletions jerry-core/jerry-api.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,10 @@ typedef struct jerry_api_value_t

uint32_t v_uint32; /**< number converted 32-bit unsigned integer */

union
{
jerry_api_string_t *v_string; /**< pointer to a JS string */
jerry_api_object_t *v_object; /**< pointer to a JS object */
};
};
jerry_api_string_t *v_string; /**< pointer to a JS string */
jerry_api_object_t *v_object; /**< pointer to a JS object */

} u;
} jerry_api_value_t;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh, union in union :) Nice catch.


/**
Expand Down
6 changes: 3 additions & 3 deletions jerry-core/jerry-snapshot.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ typedef struct
{
uint32_t last_compiled_code_offset; /**< offset of the last compiled code */
uint32_t lit_table_size; /**< size of literal table */
uint32_t is_run_global : 1; /**< flag, indicating whether the snapshot
* was dumped as 'Global scope'-mode code (true)
* or as eval-mode code (false) */
__extension__ uint32_t is_run_global : 1; /**< flag, indicating whether the snapshot
* was dumped as 'Global scope'-mode code (true)
* or as eval-mode code (false) */
} jerry_snapshot_header_t;

/**
Expand Down
Loading