fixed a rebase mistake, updated the document url on 4/4, and fixed up
typos on docs.

Arsen Arsenović (1):
  gcc/testsuite: support specifying a language for additional sources

navi (3):
  c: handle expression nodes in push_cleanup
  c: introduce jump barriers for statement expressions
  c: implement defer

 gcc/Makefile.in                  |   1 +
 gcc/c-family/c-common.cc         |   1 +
 gcc/c-family/c-common.h          |   1 +
 gcc/c-family/c-cppbuiltin.cc     |   3 +
 gcc/c/c-decl.cc                  | 145 ++++++++++++-----
 gcc/c/c-parser.cc                |  39 +++++
 gcc/c/c-tree.h                   |   8 +-
 gcc/c/c-typeck.cc                |  60 ++++++--
 gcc/doc/extend.texi              |  15 ++
 gcc/doc/sourcebuild.texi         |   7 +-
 gcc/ginclude/stddefer.h          |  38 +++++
 gcc/testsuite/g++.dg/defer-aux.c |  12 ++
 gcc/testsuite/g++.dg/defer.C     |  29 ++++
 gcc/testsuite/gcc.dg/defer-1.c   | 256 +++++++++++++++++++++++++++++++
 gcc/testsuite/gcc.dg/defer-2.c   |  78 ++++++++++
 gcc/testsuite/gcc.dg/defer-3.c   |  17 ++
 gcc/testsuite/gcc.dg/defer-4.c   |   8 +
 gcc/testsuite/lib/gcc-defs.exp   | 140 +++++++++++++----
 gcc/testsuite/lib/gcc-dg.exp     |   4 +-
 19 files changed, 781 insertions(+), 81 deletions(-)
 create mode 100644 gcc/ginclude/stddefer.h
 create mode 100644 gcc/testsuite/g++.dg/defer-aux.c
 create mode 100644 gcc/testsuite/g++.dg/defer.C
 create mode 100644 gcc/testsuite/gcc.dg/defer-1.c
 create mode 100644 gcc/testsuite/gcc.dg/defer-2.c
 create mode 100644 gcc/testsuite/gcc.dg/defer-3.c
 create mode 100644 gcc/testsuite/gcc.dg/defer-4.c

Range-diff against v9:
-:  ----------- > 1:  ac508d6b7a7 c: handle expression nodes in push_cleanup
1:  bdec86a2ad3 ! 2:  d0164ec7cf1 c: introduce jump barriers for statement 
expressions
    @@ gcc/c/c-decl.cc: finish_underspecified_init (tree name, unsigned int 
prev_state)
        in_underspecified_init = (prev_state & (1u << 1)) >> 1;
      }
      
    --/* Adjust the bindings for the start of a statement expression.  */
     +
     +/* Push or pop the jump barrier count of a statement expression.  */
     +
     +static void
     +c_binding_adjust_jump_barrier (struct c_spot_bindings *binding, bool 
start)
     +{
    -+  struct c_jump_barrier *barrier = defer
    -+    ? &binding->defer_blocks
    -+    : &binding->stmt_exprs;
    -+
     +  if (start)
    -+    barrier->count++;
    ++    binding->stmt_exprs.count++;
     +  else
    -+    barrier->count--;
    ++    binding->stmt_exprs.count--;
     +
    -+  if (barrier->count < 0)
    ++  if (binding->stmt_exprs.count < 0)
     +    {
    -+      barrier->count = 0;
    -+      barrier->left = true;
    ++      binding->stmt_exprs.count = 0;
    ++      binding->stmt_exprs.left = true;
     +    }
     +}
     +
    -+/* Adjust the bindings for the start of a statement expression or defer 
block.  */
    + /* Adjust the bindings for the start of a statement expression.  */
      
      void
    - c_bindings_start_stmt_expr (struct c_spot_bindings* switch_bindings)
     @@ gcc/c/c-decl.cc: c_bindings_start_stmt_expr (struct c_spot_bindings* 
switch_bindings)
          if (TREE_CODE (b->decl) != LABEL_DECL)
            continue;
    @@ gcc/c/c-decl.cc: c_bindings_start_stmt_expr (struct c_spot_bindings* 
switch_bind
     +      c_binding_adjust_jump_barrier (switch_bindings, true);
      }
      
    --/* Adjust the bindings for the end of a statement expression.  */
    -+/* Adjust the bindings for the end of a statement expression or defer 
block.  */
    - 
    - void
    - c_bindings_end_stmt_expr (struct c_spot_bindings *switch_bindings)
    + /* Adjust the bindings for the end of a statement expression.  */
     @@ gcc/c/c-decl.cc: c_bindings_end_stmt_expr (struct c_spot_bindings 
*switch_bindings)
          if (TREE_CODE (b->decl) != LABEL_DECL)
            continue;
    @@ gcc/c/c-decl.cc: c_bindings_end_stmt_expr (struct c_spot_bindings 
*switch_bindin
          {
     -      --switch_bindings->stmt_exprs;
     -      gcc_assert (switch_bindings->stmt_exprs >= 0);
    -+      c_binding_adjust_jump_barrier (switch_bindings, defer, false);
    ++      c_binding_adjust_jump_barrier (switch_bindings, false);
     +      gcc_assert (switch_bindings->stmt_exprs.count >= 0);
          }
      }
2:  f326f70ee14 = 3:  bc24bd62af1 gcc/testsuite: support specifying a language 
for additional sources
3:  ac9492f6281 ! 4:  ce5253004bf c: implement defer
    @@ Commit message
         local jump shall jump over a defer statement, nor shall return, break,
         and continue, jump out of one
     
    -    1: https://open-std.org/JTC1/SC22/WG14/www/docs/n3734.pdf
    +    1: https://open-std.org/JTC1/SC22/WG14/www/docs/n3928.pdf
     
         gcc/ChangeLog:
     
    @@ gcc/c/c-decl.cc: finish_underspecified_init (tree name, unsigned int 
prev_state)
      
      static void
     -c_binding_adjust_jump_barrier (struct c_spot_bindings *binding, bool 
start)
    -+c_binding_adjust_jump_barrier (struct c_spot_bindings *binding,
    -+                         bool defer, bool start)
    ++c_binding_adjust_jump_barrier (struct c_spot_bindings *binding, bool 
defer, bool start)
      {
    -   struct c_jump_barrier *barrier = defer
    -     ? &binding->defer_blocks
    -@@ gcc/c/c-decl.cc: c_binding_adjust_jump_barrier (struct c_spot_bindings 
*binding, bool start)
    - /* Adjust the bindings for the start of a statement expression or defer 
block.  */
    +-  if (start)
    +-    binding->stmt_exprs.count++;
    +-  else
    +-    binding->stmt_exprs.count--;
    ++  struct c_jump_barrier *barrier = defer
    ++    ? &binding->defer_blocks
    ++    : &binding->stmt_exprs;
    + 
    +-  if (binding->stmt_exprs.count < 0)
    ++  if (start)
    ++    barrier->count++;
    ++  else
    ++    barrier->count--;
    ++
    ++  if (barrier->count < 0)
    +     {
    +-      binding->stmt_exprs.count = 0;
    +-      binding->stmt_exprs.left = true;
    ++      barrier->count = 0;
    ++      barrier->left = true;
    +     }
    + }
    + 
    +-/* Adjust the bindings for the start of a statement expression.  */
    ++/* Adjust the bindings for the start of a statement expression or defer 
block.  */
      
      void
     -c_bindings_start_stmt_expr (struct c_spot_bindings* switch_bindings)
    @@ gcc/c/c-decl.cc: c_bindings_start_stmt_expr (struct c_spot_bindings* 
switch_bind
     +    }
      }
      
    - /* Adjust the bindings for the end of a statement expression or defer 
block.  */
    + /* Adjust the bindings for the end of a statement expression.  */
      
      void
     -c_bindings_end_stmt_expr (struct c_spot_bindings *switch_bindings)
    @@ gcc/c/c-decl.cc: c_bindings_end_stmt_expr (struct c_spot_bindings 
*switch_bindin
        }
          }
      
    -@@ gcc/c/c-decl.cc: c_bindings_end_stmt_expr (struct c_spot_bindings 
*switch_bindings)
    +   if (switch_bindings != NULL)
          {
    -       c_binding_adjust_jump_barrier (switch_bindings, defer, false);
    +-      c_binding_adjust_jump_barrier (switch_bindings, false);
    ++      c_binding_adjust_jump_barrier (switch_bindings, defer, false);
            gcc_assert (switch_bindings->stmt_exprs.count >= 0);
     +      gcc_assert (switch_bindings->defer_blocks.count >= 0);
          }
    @@ gcc/doc/extend.texi: These identifiers are variables, not preprocessor 
macros, a
     +language keyword for deferred execution of statements on scope exit. As an
     +extension, GNU C recognizes @code{_Defer} in all C versions.
     +
    -+If @option{-fexceptions} is enabled, then all defeered statements
    ++If @option{-fexceptions} is enabled, then all deferred statements
     +are run during the stack unwinding that happens during the processing
     +of the exception.  Note that the @code{_Defer} does not allow the
     +exception to be caught, only to perform an action.
-- 
2.55.0

Reply via email to