aboutsummaryrefslogtreecommitdiff
path: root/gcc/jit
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/jit')
-rw-r--r--gcc/jit/ChangeLog14
-rw-r--r--gcc/jit/jit-builtins.c14
-rw-r--r--gcc/jit/jit-logging.c2
-rw-r--r--gcc/jit/jit-playback.c11
-rw-r--r--gcc/jit/jit-recording.c10
-rw-r--r--gcc/jit/libgccjit.c12
6 files changed, 36 insertions, 27 deletions
diff --git a/gcc/jit/ChangeLog b/gcc/jit/ChangeLog
index 7be5c47..eb2f793 100644
--- a/gcc/jit/ChangeLog
+++ b/gcc/jit/ChangeLog
@@ -1,3 +1,17 @@
+2017-12-19 Jakub Jelinek <jakub@redhat.com>
+
+ * jit-playback.c (get_type, playback::compile_to_file::copy_file,
+ playback::context::acquire_mutex): Replace Yoda conditions with
+ typical order conditions.
+ * libgccjit.c (gcc_jit_context_new_struct_type,
+ gcc_jit_struct_set_fields, gcc_jit_context_new_union_type,
+ gcc_jit_context_new_function, gcc_jit_timer_pop): Likewise.
+ * jit-builtins.c (matches_builtin): Likewise.
+ * jit-recording.c (recording::compound_type::set_fields,
+ recording::fields::write_reproducer, recording::rvalue::set_scope,
+ recording::function::validate): Likewise.
+ * jit-logging.c (logger::decref): Likewise.
+
2017-11-30 Jakub Jelinek <jakub@redhat.com>
* jit-recording.c
diff --git a/gcc/jit/jit-builtins.c b/gcc/jit/jit-builtins.c
index 35c4db0..ee37495 100644
--- a/gcc/jit/jit-builtins.c
+++ b/gcc/jit/jit-builtins.c
@@ -76,24 +76,20 @@ matches_builtin (const char *in_name,
if (debug)
fprintf (stderr, "seen builtin: %s\n", bd.name);
- if (0 == strcmp (bd.name, in_name))
- {
- return true;
- }
+ if (strcmp (bd.name, in_name) == 0)
+ return true;
if (bd.both_p)
{
/* Then the macros in builtins.def gave a "__builtin_"
prefix to bd.name, but we should also recognize the form
without the prefix. */
- gcc_assert (0 == strncmp (bd.name, prefix, prefix_len));
+ gcc_assert (strncmp (bd.name, prefix, prefix_len) == 0);
if (debug)
fprintf (stderr, "testing without prefix as: %s\n",
bd.name + prefix_len);
- if (0 == strcmp (bd.name + prefix_len, in_name))
- {
- return true;
- }
+ if (strcmp (bd.name + prefix_len, in_name) == 0)
+ return true;
}
return false;
diff --git a/gcc/jit/jit-logging.c b/gcc/jit/jit-logging.c
index 9c39f62..779b756 100644
--- a/gcc/jit/jit-logging.c
+++ b/gcc/jit/jit-logging.c
@@ -79,7 +79,7 @@ logger::decref (const char *reason)
if (m_log_refcount_changes)
log ("%s: reason: %s refcount now %i",
__PRETTY_FUNCTION__, reason, m_refcount);
- if (0 == m_refcount)
+ if (m_refcount == 0)
delete this;
}
diff --git a/gcc/jit/jit-playback.c b/gcc/jit/jit-playback.c
index fe9fb2d..43b0ec9 100644
--- a/gcc/jit/jit-playback.c
+++ b/gcc/jit/jit-playback.c
@@ -211,10 +211,9 @@ playback::context::
get_type (enum gcc_jit_types type_)
{
tree type_node = get_tree_node_for_type (type_);
- if (NULL == type_node)
+ if (type_node == NULL)
{
- add_error (NULL,
- "unrecognized (enum gcc_jit_types) value: %i", type_);
+ add_error (NULL, "unrecognized (enum gcc_jit_types) value: %i", type_);
return NULL;
}
@@ -2049,7 +2048,7 @@ playback::compile_to_file::copy_file (const char *src_path,
/* Use stat on the filedescriptor to get the mode,
so that we can copy it over (in particular, the
"executable" bits). */
- if (-1 == fstat (fileno (f_in), &stat_buf))
+ if (fstat (fileno (f_in), &stat_buf) == -1)
{
add_error (NULL,
"unable to fstat %s: %s",
@@ -2113,7 +2112,7 @@ playback::compile_to_file::copy_file (const char *src_path,
/* Set the permissions of the copy to those of the original file,
in particular the "executable" bits. */
- if (-1 == fchmod (fileno (f_out), stat_buf.st_mode))
+ if (fchmod (fileno (f_out), stat_buf.st_mode) == -1)
add_error (NULL,
"error setting mode of %s: %s",
dst_path,
@@ -2139,7 +2138,7 @@ playback::context::acquire_mutex ()
/* Acquire the big GCC mutex. */
JIT_LOG_SCOPE (get_logger ());
pthread_mutex_lock (&jit_mutex);
- gcc_assert (NULL == active_playback_ctxt);
+ gcc_assert (active_playback_ctxt == NULL);
active_playback_ctxt = this;
}
diff --git a/gcc/jit/jit-recording.c b/gcc/jit/jit-recording.c
index fb492c0..f2cfcfd 100644
--- a/gcc/jit/jit-recording.c
+++ b/gcc/jit/jit-recording.c
@@ -2987,7 +2987,7 @@ recording::compound_type::set_fields (location *loc,
field **field_array)
{
m_loc = loc;
- gcc_assert (NULL == m_fields);
+ gcc_assert (m_fields == NULL);
m_fields = new fields (this, num_fields, field_array);
m_ctxt->record (m_fields);
@@ -3182,7 +3182,7 @@ void
recording::fields::write_reproducer (reproducer &r)
{
if (m_struct_or_union)
- if (NULL == m_struct_or_union->dyn_cast_struct ())
+ if (m_struct_or_union->dyn_cast_struct () == NULL)
/* We have a union; the fields have already been written by
union::write_reproducer. */
return;
@@ -3370,7 +3370,7 @@ void
recording::rvalue::set_scope (function *scope)
{
gcc_assert (scope);
- gcc_assert (NULL == m_scope);
+ gcc_assert (m_scope == NULL);
m_scope = scope;
}
@@ -3750,7 +3750,7 @@ recording::function::validate ()
/* Complain about empty functions with non-void return type. */
if (m_kind != GCC_JIT_FUNCTION_IMPORTED
&& m_return_type != m_ctxt->get_type (GCC_JIT_TYPE_VOID))
- if (0 == m_blocks.length ())
+ if (m_blocks.length () == 0)
m_ctxt->add_error (m_loc,
"function %s returns non-void (type: %s)"
" but has no blocks",
@@ -3771,7 +3771,7 @@ recording::function::validate ()
/* Check that all blocks are reachable. */
if (!m_ctxt->get_inner_bool_option
(INNER_BOOL_OPTION_ALLOW_UNREACHABLE_BLOCKS)
- && m_blocks.length () > 0 && 0 == num_invalid_blocks)
+ && m_blocks.length () > 0 && num_invalid_blocks == 0)
{
/* Iteratively walk the graph of blocks, marking their "m_is_reachable"
flag, starting at the initial block. */
diff --git a/gcc/jit/libgccjit.c b/gcc/jit/libgccjit.c
index 8bad4f6..fa8ef35 100644
--- a/gcc/jit/libgccjit.c
+++ b/gcc/jit/libgccjit.c
@@ -592,7 +592,7 @@ gcc_jit_context_new_struct_type (gcc_jit_context *ctxt,
{
RETURN_NULL_IF_FAIL (fields[i], ctxt, loc, "NULL field ptr");
RETURN_NULL_IF_FAIL_PRINTF2 (
- NULL == fields[i]->get_container (),
+ fields[i]->get_container () == NULL,
ctxt, loc,
"%s is already a field of %s",
fields[i]->get_debug_string (),
@@ -657,7 +657,7 @@ gcc_jit_struct_set_fields (gcc_jit_struct *struct_type,
JIT_LOG_FUNC (ctxt->get_logger ());
/* LOC can be NULL. */
RETURN_IF_FAIL_PRINTF1 (
- NULL == struct_type->get_fields (), ctxt, loc,
+ struct_type->get_fields () == NULL, ctxt, loc,
"%s already has had fields set",
struct_type->get_debug_string ());
if (num_fields)
@@ -671,7 +671,7 @@ gcc_jit_struct_set_fields (gcc_jit_struct *struct_type,
struct_type->get_debug_string (),
i);
RETURN_IF_FAIL_PRINTF2 (
- NULL == fields[i]->get_container (),
+ fields[i]->get_container () == NULL,
ctxt, loc,
"%s is already a field of %s",
fields[i]->get_debug_string (),
@@ -706,7 +706,7 @@ gcc_jit_context_new_union_type (gcc_jit_context *ctxt,
{
RETURN_NULL_IF_FAIL (fields[i], ctxt, loc, "NULL field ptr");
RETURN_NULL_IF_FAIL_PRINTF2 (
- NULL == fields[i]->get_container (),
+ fields[i]->get_container () == NULL,
ctxt, loc,
"%s is already a field of %s",
fields[i]->get_debug_string (),
@@ -880,7 +880,7 @@ gcc_jit_context_new_function (gcc_jit_context *ctxt,
ctxt, loc,
"NULL parameter %i creating function %s", i, name);
RETURN_NULL_IF_FAIL_PRINTF5 (
- (NULL == params[i]->get_scope ()),
+ params[i]->get_scope () == NULL,
ctxt, loc,
"parameter %i \"%s\""
" (type: %s)"
@@ -2925,7 +2925,7 @@ gcc_jit_timer_pop (gcc_jit_timer *timer,
item_name);
RETURN_IF_FAIL_PRINTF2
- (0 == strcmp (item_name, top_item_name), NULL, NULL,
+ (strcmp (item_name, top_item_name) == 0, NULL, NULL,
"mismatching item_name:"
" top of timing stack: \"%s\","
" attempting to pop: \"%s\"",