[gtk+/wip/otte/shader: 55/151] gsksl: Don't return a value from gsk_sl_statement_write_spv()



commit 6e221b1d124495a05ce50e098d8626d6081f6778
Author: Benjamin Otte <otte redhat com>
Date:   Sat Sep 30 15:11:51 2017 +0200

    gsksl: Don't return a value from gsk_sl_statement_write_spv()
    
    Statements emit code, they don't return any values. That's what
    expressions are for.

 gsk/gskslstatement.c        |   25 +++++++++----------------
 gsk/gskslstatementprivate.h |    2 +-
 2 files changed, 10 insertions(+), 17 deletions(-)
---
diff --git a/gsk/gskslstatement.c b/gsk/gskslstatement.c
index 64f72d9..29f0bbe 100644
--- a/gsk/gskslstatement.c
+++ b/gsk/gskslstatement.c
@@ -46,7 +46,7 @@ struct _GskSlStatementClass {
 
   void                  (* print)                               (const GskSlStatement   *statement,
                                                                  GskSlPrinter           *printer);
-  guint32               (* write_spv)                           (const GskSlStatement   *statement,
+  void                  (* write_spv)                           (const GskSlStatement   *statement,
                                                                  GskSpvWriter           *writer);
 };
 
@@ -88,11 +88,10 @@ gsk_sl_statement_empty_print (const GskSlStatement *statement,
   gsk_sl_printer_append (printer, ";");
 }
 
-static guint32
+static void
 gsk_sl_statement_empty_write_spv (const GskSlStatement *statement,
                                   GskSpvWriter         *writer)
 {
-  return 0;
 }
 
 static const GskSlStatementClass GSK_SL_STATEMENT_EMPTY = {
@@ -143,7 +142,7 @@ gsk_sl_statement_compound_print (const GskSlStatement *statement,
   gsk_sl_printer_append (printer, "}");
 }
 
-static guint32
+static void
 gsk_sl_statement_compound_write_spv (const GskSlStatement *statement,
                                      GskSpvWriter         *writer)
 {
@@ -154,8 +153,6 @@ gsk_sl_statement_compound_write_spv (const GskSlStatement *statement,
     {
       gsk_sl_statement_write_spv (l->data, writer);
     }
-
-  return 0;
 }
 
 static const GskSlStatementClass GSK_SL_STATEMENT_COMPOUND = {
@@ -202,7 +199,7 @@ gsk_sl_statement_declaration_print (const GskSlStatement *statement,
   gsk_sl_printer_append (printer, ";");
 }
 
-static guint32
+static void
 gsk_sl_statement_declaration_write_spv (const GskSlStatement *statement,
                                         GskSpvWriter         *writer)
 {
@@ -219,8 +216,6 @@ gsk_sl_statement_declaration_write_spv (const GskSlStatement *statement,
                           (guint32[2]) { variable_id,
                                          gsk_sl_expression_write_spv (declaration->initial, writer)});
     }
-
-  return variable_id;
 }
 
 static const GskSlStatementClass GSK_SL_STATEMENT_DECLARATION = {
@@ -265,13 +260,11 @@ gsk_sl_statement_return_print (const GskSlStatement *statement,
   gsk_sl_printer_append (printer, ";");
 }
 
-static guint32
+static void
 gsk_sl_statement_return_write_spv (const GskSlStatement *statement,
                                    GskSpvWriter         *writer)
 {
   g_assert_not_reached ();
-
-  return 0;
 }
 
 static const GskSlStatementClass GSK_SL_STATEMENT_RETURN = {
@@ -310,13 +303,13 @@ gsk_sl_statement_expression_print (const GskSlStatement *statement,
   gsk_sl_printer_append (printer, ";");
 }
  
-static guint32
+static void
 gsk_sl_statement_expression_write_spv (const GskSlStatement *statement,
                                        GskSpvWriter         *writer)
 {
   GskSlStatementExpression *expression_statement = (GskSlStatementExpression *) statement;
 
-  return gsk_sl_expression_write_spv (expression_statement->expression, writer);
+  gsk_sl_expression_write_spv (expression_statement->expression, writer);
 }
  
 static const GskSlStatementClass GSK_SL_STATEMENT_EXPRESSION = {
@@ -654,10 +647,10 @@ gsk_sl_statement_print (const GskSlStatement *statement,
   statement->class->print (statement, printer);
 }
 
-guint32
+void
 gsk_sl_statement_write_spv (const GskSlStatement *statement,
                             GskSpvWriter         *writer)
 {
-  return statement->class->write_spv (statement, writer);
+  statement->class->write_spv (statement, writer);
 }
 
diff --git a/gsk/gskslstatementprivate.h b/gsk/gskslstatementprivate.h
index f8ae5eb..1e4098f 100644
--- a/gsk/gskslstatementprivate.h
+++ b/gsk/gskslstatementprivate.h
@@ -37,7 +37,7 @@ void                    gsk_sl_statement_unref                  (GskSlStatement
 void                    gsk_sl_statement_print                  (const GskSlStatement   *statement,
                                                                  GskSlPrinter           *printer);
 
-guint32                 gsk_sl_statement_write_spv              (const GskSlStatement   *statement,
+void                    gsk_sl_statement_write_spv              (const GskSlStatement   *statement,
                                                                  GskSpvWriter           *writer);
 
 G_END_DECLS


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]