目录
Richard Barnes

Remove unreachable returns in instagram, monitoring, langtech and others (+28)

Summary: The clang-diagnostic-unreachable-code-return continuous-lint check flags return statements that clang can prove never execute. This diff removes 28 such returns. In each case the preceding statement never completes in any build configuration:

  • instagram/ranking/mezql (9): MEZQL_EXCEPTION / MEZQL_CLIENT_EXCEPTION expand to MEZQL_EXCEPTION_BASE, an unconditional (throw exception(...)).
  • monitoring/obql, monitoring/promql (6): OBQL_FAIL() << ... builds an ObqlExceptionThrower whose operator| always throws; switch cases that do not fail all return.
  • langtech/tts (4): NDTENSOR_DTYPE_SIZE_DISPATCH is a switch whose cases all return and whose default: is TORCH_INTERNAL_ASSERT(false, ...), which always throws.
  • mocha2: MOCHA_THROW_STRUCTURED is a plain throw.
  • polaris: POLARIS_ASSERT(false, ...) is if (!(false)) throw std::runtime_error(...).
  • on_device_ai/helios: FTL(...) in nlu3/logging/logging_macros.h is the #if 1 branch, throw std::runtime_error(...).
  • kudu: LOG_WITH_PREFIX_UNLOCKED(FATAL) is glog LOG(FATAL), [[noreturn]] in every mode.
  • manifold/walker: the default: case does throw ManifoldException::NOT_ALLOWED(...); every other case returns.
  • mediaio: the return follows a for (;;) loop that only exits via return.
  • koski test: KOSKI_RUNTIME_ERROR_EX always throws; the lambda gets an explicit -> MockData return type so its signature is unchanged without the dead return.
  • ods3 test: throwHostOverloaded() is declared [[noreturn]]; the two callbacks now declare -> Router3PutResult and call it as a statement instead of returning its (never produced) result.

Part of T294580822.

Test Plan: Built every owning target of the changed files (buck2 uquery "owner('<file>')") in both modes; both builds succeeded with no new warnings:

buck2 build --keep-going fbcode//mode/opt <targets>
buck2 build --keep-going fbcode//mode/dev <targets>

Targets:

  • fbcode//instagram/ranking/mezql/shots/core:core
  • fbcode//instagram/ranking/mezql/shots/rules/barkeep:distillation_logger
  • fbcode//instagram/ranking/mezql/shots/rules/barkeep:ranker_response_parser
  • fbcode//instagram/ranking/mezql/shots/rules/brewery:brewery_filter_rule
  • fbcode//instagram/ranking/mezql/shots/rules/comment_ranking:comment_ranking_fs_rules
  • fbcode//instagram/ranking/mezql/shots/rules/connections_ml:candidates_from_category_rule
  • fbcode//instagram/ranking/mezql/shots/rules/connections_ml:featurestore_rule
  • fbcode//instagram/ranking/mezql/shots/rules/connections_ml:inference_rule
  • fbcode//instagram/ranking/mezql/shots/rules/fast:fast_laser_rules
  • fbcode//koski/connect/scribe/reader/tests:test_koski_scribe_reader
  • fbcode//kudu/consensus:consensus_queue
  • fbcode//langtech/tts/cli/models/wavernn_gpu/csrc:wavernn_gpu
  • fbcode//manifold/walker/workflow/common:stats_computation_processor
  • fbcode//mediaio:mediaio
  • fbcode//mocha2/nodes/feature/ig:redstar_derived_feature_node
  • fbcode//monitoring/obql/exec/crux:crux_to_velox
  • fbcode//monitoring/obql/exec/crux:obql_crux_to_velox
  • fbcode//monitoring/obql/semantic/crux:obql_crux_compiler
  • fbcode//monitoring/promql/promql_compiler:promql_crux_to_velox
  • fbcode//ods3/services/ingestion/egress/test:egress_test
  • fbcode//on_device_ai/helios/pytorch/turing/nlu4:nlu4_base
  • fbcode//polaris/tao:tao_polaris_whupdate

Reviewed By: dtolnay

Differential Revision: D127395964

fbshipit-source-id: b9cba95055c883ea95f261d15ea6eb126568f3bd

3天前9537次提交
邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9 京公网安备 11010802047560号