Remove superfluous lines from DSL generated code.

The comma-warning issue has since been fixed, and we don't need to
use `(void) var;` when we have C++17's [[maybe_unused]] attribute.

Change-Id: I2078354f06801b024638e9c7d9ac699df20a8c48
Bug: skia:11854
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/401116
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This commit is contained in:
John Stiles 2021-04-26 11:40:41 -04:00 committed by Skia Commit-Bot
parent fbc06d831f
commit 119ad7329d
11 changed files with 11 additions and 66 deletions

View File

@ -941,8 +941,7 @@ static bool is_accessible(const Variable& var) {
bool DSLCPPCodeGenerator::writeEmitCode(std::vector<const Variable*>& uniforms) {
this->writef(" void emitCode(EmitArgs& args) override {\n"
" const %s& _outer = args.fFp.cast<%s>();\n"
" (void) _outer;\n"
" [[maybe_unused]] const %s& _outer = args.fFp.cast<%s>();\n"
"\n"
" using namespace SkSL::dsl;\n"
" StartFragmentProcessor(this, &args);\n",
@ -1370,10 +1369,6 @@ bool DSLCPPCodeGenerator::generateCode() {
"#include \"src/sksl/dsl/priv/DSLFPs.h\"\n"
"#include \"src/sksl/dsl/priv/DSLWriter.h\"\n"
"\n"
"#if defined(__clang__)\n"
"#pragma clang diagnostic ignored \"-Wcomma\"\n"
"#endif\n"
"\n"
"class GrGLSL%s : public GrGLSLFragmentProcessor {\n"
"public:\n"
" GrGLSL%s() {}\n",

View File

@ -16,16 +16,11 @@
#include "src/sksl/dsl/priv/DSLFPs.h"
#include "src/sksl/dsl/priv/DSLWriter.h"
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wcomma"
#endif
class GrGLSLDSLFPTest_Builtins : public GrGLSLFragmentProcessor {
public:
GrGLSLDSLFPTest_Builtins() {}
void emitCode(EmitArgs& args) override {
const GrDSLFPTest_Builtins& _outer = args.fFp.cast<GrDSLFPTest_Builtins>();
(void) _outer;
[[maybe_unused]] const GrDSLFPTest_Builtins& _outer = args.fFp.cast<GrDSLFPTest_Builtins>();
using namespace SkSL::dsl;
StartFragmentProcessor(this, &args);

View File

@ -16,16 +16,11 @@
#include "src/sksl/dsl/priv/DSLFPs.h"
#include "src/sksl/dsl/priv/DSLWriter.h"
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wcomma"
#endif
class GrGLSLDSLFPTest_DoStatement : public GrGLSLFragmentProcessor {
public:
GrGLSLDSLFPTest_DoStatement() {}
void emitCode(EmitArgs& args) override {
const GrDSLFPTest_DoStatement& _outer = args.fFp.cast<GrDSLFPTest_DoStatement>();
(void) _outer;
[[maybe_unused]] const GrDSLFPTest_DoStatement& _outer = args.fFp.cast<GrDSLFPTest_DoStatement>();
using namespace SkSL::dsl;
StartFragmentProcessor(this, &args);

View File

@ -16,16 +16,11 @@
#include "src/sksl/dsl/priv/DSLFPs.h"
#include "src/sksl/dsl/priv/DSLWriter.h"
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wcomma"
#endif
class GrGLSLDSLFPTest_ForStatement : public GrGLSLFragmentProcessor {
public:
GrGLSLDSLFPTest_ForStatement() {}
void emitCode(EmitArgs& args) override {
const GrDSLFPTest_ForStatement& _outer = args.fFp.cast<GrDSLFPTest_ForStatement>();
(void) _outer;
[[maybe_unused]] const GrDSLFPTest_ForStatement& _outer = args.fFp.cast<GrDSLFPTest_ForStatement>();
using namespace SkSL::dsl;
StartFragmentProcessor(this, &args);

View File

@ -16,16 +16,11 @@
#include "src/sksl/dsl/priv/DSLFPs.h"
#include "src/sksl/dsl/priv/DSLWriter.h"
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wcomma"
#endif
class GrGLSLDSLFPTest_HelloWorld : public GrGLSLFragmentProcessor {
public:
GrGLSLDSLFPTest_HelloWorld() {}
void emitCode(EmitArgs& args) override {
const GrDSLFPTest_HelloWorld& _outer = args.fFp.cast<GrDSLFPTest_HelloWorld>();
(void) _outer;
[[maybe_unused]] const GrDSLFPTest_HelloWorld& _outer = args.fFp.cast<GrDSLFPTest_HelloWorld>();
using namespace SkSL::dsl;
StartFragmentProcessor(this, &args);

View File

@ -16,16 +16,11 @@
#include "src/sksl/dsl/priv/DSLFPs.h"
#include "src/sksl/dsl/priv/DSLWriter.h"
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wcomma"
#endif
class GrGLSLDSLFPTest_IfStatement : public GrGLSLFragmentProcessor {
public:
GrGLSLDSLFPTest_IfStatement() {}
void emitCode(EmitArgs& args) override {
const GrDSLFPTest_IfStatement& _outer = args.fFp.cast<GrDSLFPTest_IfStatement>();
(void) _outer;
[[maybe_unused]] const GrDSLFPTest_IfStatement& _outer = args.fFp.cast<GrDSLFPTest_IfStatement>();
using namespace SkSL::dsl;
StartFragmentProcessor(this, &args);

View File

@ -16,16 +16,11 @@
#include "src/sksl/dsl/priv/DSLFPs.h"
#include "src/sksl/dsl/priv/DSLWriter.h"
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wcomma"
#endif
class GrGLSLDSLFPTest_Sample : public GrGLSLFragmentProcessor {
public:
GrGLSLDSLFPTest_Sample() {}
void emitCode(EmitArgs& args) override {
const GrDSLFPTest_Sample& _outer = args.fFp.cast<GrDSLFPTest_Sample>();
(void) _outer;
[[maybe_unused]] const GrDSLFPTest_Sample& _outer = args.fFp.cast<GrDSLFPTest_Sample>();
using namespace SkSL::dsl;
StartFragmentProcessor(this, &args);

View File

@ -16,16 +16,11 @@
#include "src/sksl/dsl/priv/DSLFPs.h"
#include "src/sksl/dsl/priv/DSLWriter.h"
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wcomma"
#endif
class GrGLSLDSLFPTest_SwitchStatement : public GrGLSLFragmentProcessor {
public:
GrGLSLDSLFPTest_SwitchStatement() {}
void emitCode(EmitArgs& args) override {
const GrDSLFPTest_SwitchStatement& _outer = args.fFp.cast<GrDSLFPTest_SwitchStatement>();
(void) _outer;
[[maybe_unused]] const GrDSLFPTest_SwitchStatement& _outer = args.fFp.cast<GrDSLFPTest_SwitchStatement>();
using namespace SkSL::dsl;
StartFragmentProcessor(this, &args);

View File

@ -16,16 +16,11 @@
#include "src/sksl/dsl/priv/DSLFPs.h"
#include "src/sksl/dsl/priv/DSLWriter.h"
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wcomma"
#endif
class GrGLSLDSLFPTest_Swizzle : public GrGLSLFragmentProcessor {
public:
GrGLSLDSLFPTest_Swizzle() {}
void emitCode(EmitArgs& args) override {
const GrDSLFPTest_Swizzle& _outer = args.fFp.cast<GrDSLFPTest_Swizzle>();
(void) _outer;
[[maybe_unused]] const GrDSLFPTest_Swizzle& _outer = args.fFp.cast<GrDSLFPTest_Swizzle>();
using namespace SkSL::dsl;
StartFragmentProcessor(this, &args);

View File

@ -16,16 +16,11 @@
#include "src/sksl/dsl/priv/DSLFPs.h"
#include "src/sksl/dsl/priv/DSLWriter.h"
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wcomma"
#endif
class GrGLSLDSLFPTest_Ternary : public GrGLSLFragmentProcessor {
public:
GrGLSLDSLFPTest_Ternary() {}
void emitCode(EmitArgs& args) override {
const GrDSLFPTest_Ternary& _outer = args.fFp.cast<GrDSLFPTest_Ternary>();
(void) _outer;
[[maybe_unused]] const GrDSLFPTest_Ternary& _outer = args.fFp.cast<GrDSLFPTest_Ternary>();
using namespace SkSL::dsl;
StartFragmentProcessor(this, &args);

View File

@ -16,16 +16,11 @@
#include "src/sksl/dsl/priv/DSLFPs.h"
#include "src/sksl/dsl/priv/DSLWriter.h"
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wcomma"
#endif
class GrGLSLDSLFPTest_WhileStatement : public GrGLSLFragmentProcessor {
public:
GrGLSLDSLFPTest_WhileStatement() {}
void emitCode(EmitArgs& args) override {
const GrDSLFPTest_WhileStatement& _outer = args.fFp.cast<GrDSLFPTest_WhileStatement>();
(void) _outer;
[[maybe_unused]] const GrDSLFPTest_WhileStatement& _outer = args.fFp.cast<GrDSLFPTest_WhileStatement>();
using namespace SkSL::dsl;
StartFragmentProcessor(this, &args);