Oneflow-Inc / oneflow

OneFlow is a deep learning framework designed to be user-friendly, scalable and efficient.
http://www.oneflow.org
Apache License 2.0
5.91k stars 667 forks source link

/oneflow/oneflow/xrt/xla/ops/scalar_binary_op.cpp:47:3: error: control reaches end of non-void function [-Werror=return-type] #3414

Open qianzhang613 opened 4 years ago

qianzhang613 commented 4 years ago

the line 47 of /oneflow/oneflow/xrt/xla/ops/scalar_binary_op.cpp :

  xla::XlaOp Scalar(XlaOpContext *ctx) const {
    xla::XlaBuilder *builder = ctx->builder();
    DataType data_type = ctx->SoleInputType();
    if (ctx->Attr<bool>("has_int_operand")) {
      int64_t value = ctx->Attr<int64_t>("int_operand");
      return IntegerLiteral(builder, data_type, value);
    } else if (ctx->Attr<bool>("has_float_operand")) {
      double value = ctx->Attr<double>("float_operand");
      return FloatLiteral(builder, data_type, value);
    }
  }

need add return statement.

Ldpe2G commented 4 years ago

@qianzhang613 you can quickly fix this by removing the -Werror=return-type option in CMakeLists.txt. Then retype cmake and recompile.

https://github.com/Oneflow-Inc/oneflow/blob/master/CMakeLists.txt#L123

qianzhang613 commented 4 years ago

@qianzhang613 you can quickly fix this by removing the -Werror=return-type option in CMakeLists.txt. Then retype cmake and recompile.

https://github.com/Oneflow-Inc/oneflow/blob/master/CMakeLists.txt#L123

ok, that works thanks.

it is better to just add error return at the end.