Reduce build warnings

This commit is contained in:
2025-12-28 01:34:46 +09:00
parent b104d6af5f
commit 0269fc2ed4
41 changed files with 77 additions and 26 deletions

View File

@ -293,6 +293,21 @@ debug = true
[profile.release.package."nyash-net-plugin"]
opt-level = "z"
strip = true
[profile.release.package."nyash-console-plugin"]
opt-level = "z"
strip = true
[profile.release.package."nyash-counter-plugin"]
opt-level = "z"
strip = true
[profile.release.package."nyash-filebox-plugin"]
opt-level = "z"
strip = true
[profile.release.package."nyash-json-plugin"]
opt-level = "z"
strip = true
[profile.release.package."nyash-math-plugin"]
opt-level = "z"
strip = true
[[bin]]
name = "hakorune-rust"

View File

@ -8,8 +8,3 @@ crate-type = ["cdylib", "staticlib"]
[dependencies]
once_cell = "1.20"
[profile.release]
lto = true
strip = true
opt-level = "z"

View File

@ -11,8 +11,3 @@ once_cell = "1.20"
[features]
default = []
[profile.release]
lto = true
strip = true
opt-level = "z"

View File

@ -12,9 +12,3 @@ once_cell = "1.20"
[features]
default = []
# プロファイル設定
[profile.release]
lto = true
strip = true
opt-level = "z" # サイズ最適化

View File

@ -12,8 +12,3 @@ serde_json = "1.0"
[build-dependencies]
cc = "1.0"
[profile.release]
lto = true
strip = true
opt-level = "z"

View File

@ -9,8 +9,3 @@ crate-type = ["cdylib"]
[dependencies]
once_cell = "1.20"
[profile.release]
lto = true
strip = true
opt-level = "z"

View File

@ -47,6 +47,7 @@ impl MirBuilder {
.unwrap_or_default()
}
#[allow(dead_code)]
pub(super) fn method_candidates_tail<S: AsRef<str>>(&mut self, tail: S) -> Vec<String> {
self.ensure_method_tail_index();
self.comp_ctx

View File

@ -99,6 +99,7 @@ pub(crate) struct CompilationContext {
pub quiet_internal_logs: bool,
}
#[allow(dead_code)]
impl CompilationContext {
/// Create a new CompilationContext with default-initialized state
pub fn new() -> Self {

View File

@ -43,6 +43,7 @@ use crate::mir::control_form::LoopId;
/// - `header`: ループヘッダーContinue の配線先)
/// - `after`: ループ後のブロックBreak の配線先)
/// - `body`: ループ本体の断片
#[allow(dead_code)]
pub(crate) fn loop_(
loop_id: LoopId,
header: BasicBlockId,

View File

@ -37,6 +37,7 @@ use crate::mir::builder::control_flow::edgecfg::api::frag::Frag;
/// # 引数
/// - `a`: 前段の断片
/// - `b`: 後段の断片
#[allow(dead_code)]
pub(crate) fn seq(a: Frag, b: Frag) -> Frag {
let mut exits = BTreeMap::new();
let mut wires = Vec::new();

View File

@ -64,6 +64,7 @@ impl EdgeStub {
}
/// 既に配線先が確定している EdgeStub を生成(テスト/配線済み用途)
#[allow(dead_code)]
pub fn with_target(
from: BasicBlockId,
kind: ExitKind,

View File

@ -30,9 +30,11 @@ pub enum ExitKind {
Break(LoopId),
/// 指定ループの次回イテレーション
#[allow(dead_code)]
Continue(LoopId),
/// 例外のunwindInvoke.err → catch
#[allow(dead_code)]
Unwind,
/// 非同期タスクのキャンセル(予約:将来の async/drop 用)
@ -42,11 +44,13 @@ pub enum ExitKind {
impl ExitKind {
/// ループ関連の脱出か判定
#[allow(dead_code)]
pub fn is_loop_exit(&self) -> bool {
matches!(self, ExitKind::Break(_) | ExitKind::Continue(_))
}
/// 関数全体からの脱出か判定
#[allow(dead_code)]
pub fn is_function_exit(&self) -> bool {
matches!(self, ExitKind::Return | ExitKind::Unwind)
}

View File

@ -83,16 +83,19 @@ impl Frag {
}
/// 特定 ExitKind の未配線 edge を追加
#[allow(dead_code)]
pub fn add_exit(&mut self, stub: EdgeStub) {
self.exits.entry(stub.kind).or_insert_with(Vec::new).push(stub);
}
/// 特定 ExitKind の未配線 edge を取得
#[allow(dead_code)]
pub fn get_exits(&self, kind: &ExitKind) -> Option<&Vec<EdgeStub>> {
self.exits.get(kind)
}
/// すべての ExitKind を列挙
#[allow(dead_code)]
pub fn exit_kinds(&self) -> impl Iterator<Item = &ExitKind> {
self.exits.keys()
}

View File

@ -21,6 +21,7 @@ use super::frag::Frag;
/// # Phase 265 P2
/// - wires/exits 分離契約の「置き場所」確保
/// - 警告出力のみ、Err 化は Phase 266 で実施
#[allow(dead_code)]
pub fn verify_frag_invariants(frag: &Frag) -> Result<(), String> {
// Phase 265 P2: exits と wires の両方が空の場合は警告
if frag.exits.is_empty() && frag.wires.is_empty() {

View File

@ -23,6 +23,7 @@ use crate::mir::loop_pattern_detection::{LoopFeatures, LoopPatternKind};
/// 1. Create with `new()` - AST + Router info only
/// 2. Call `set_canonicalizer_result()` - Add Canonicalizer output
/// 3. Call `verify_parity()` - Check consistency (dev-only)
#[allow(dead_code)]
#[derive(Debug)]
pub struct LoopProcessingContext<'a> {
// ========================================================================
@ -56,6 +57,7 @@ pub struct LoopProcessingContext<'a> {
pub features: LoopFeatures,
}
#[allow(dead_code)]
impl<'a> LoopProcessingContext<'a> {
/// Create new context (canonicalizer not run yet)
///

View File

@ -9,8 +9,10 @@ pub struct MergeConfig {
/// Enable strict contract verification (fail-fast on violations)
pub strict_mode: bool,
/// Exit reconnection mode (Phi or DirectValue)
#[allow(dead_code)]
pub exit_reconnect_mode: Option<crate::mir::join_ir::lowering::carrier_info::ExitReconnectMode>,
/// Allow missing exit block in contract checks (typically exit_block_id before insertion)
#[allow(dead_code)]
pub allow_missing_exit_block: bool,
}
@ -26,6 +28,7 @@ impl MergeConfig {
}
/// Strict configuration for development/debugging (all checks enabled)
#[allow(dead_code)]
pub fn strict() -> Self {
Self {
dev_log: true,

View File

@ -37,6 +37,7 @@ use std::collections::BTreeMap;
#[derive(Debug, Clone)]
pub struct ExitArgsCollectionResult {
/// The source block for these values
#[allow(dead_code)]
pub block_id: BasicBlockId,
/// The expression result value (jump_args[0], optional)
pub expr_result_value: Option<ValueId>,
@ -232,6 +233,7 @@ impl ExitArgsCollectorBox {
/// Convenience method: Convert collected carrier values to BTreeMap
///
/// This matches the format expected by instruction_rewriter.rs's carrier_inputs.
#[allow(dead_code)]
pub fn to_carrier_map(
carrier_values: Vec<(String, (BasicBlockId, ValueId))>,
) -> BTreeMap<String, Vec<(BasicBlockId, ValueId)>> {

View File

@ -24,6 +24,8 @@
//! - `is_skippable_continuation`: Structural check for skippable continuation functions
//! - `merge_and_rewrite`: Main orchestrator for JoinIR→MIR merge
#![allow(dead_code)]
// Phase 260 P0.1 Step 1: Forward all declarations to parent instruction_rewriter.rs
// This allows gradual migration without breaking existing code.
//

View File

@ -18,6 +18,8 @@
//! - Remapping of ValueIds (handled by JoinIrIdRemapper)
//! - Instruction rewriting of non-k_exit instructions (handled by instruction_rewriter)
#![allow(dead_code)]
use crate::mir::{BasicBlockId, MirInstruction, ValueId};
use std::collections::BTreeSet;

View File

@ -52,6 +52,8 @@
//! Phase 255 P2: Common Utilities
//! - common/: Shared helper functions (var() etc.) to eliminate code duplication
#![allow(dead_code)]
pub(in crate::mir::builder) mod common; // Phase 255 P2: Common AST helpers
pub(in crate::mir::builder) mod extractors; // Phase 282 P3: Common extraction interfaces
pub(in crate::mir::builder) mod pattern_recognizers; // Phase 287 P1: Modularized pattern recognizers

View File

@ -162,6 +162,7 @@ impl NormalizationExecuteBox {
/// Execute Phase 132-133: Loop + post assignments + return
///
/// ## Phase 141 P1.5: Added prefix_variables parameter
#[allow(dead_code)]
fn execute_loop_with_post(
builder: &mut MirBuilder,
plan: &NormalizationPlan,

View File

@ -17,6 +17,7 @@ pub struct NormalizationPlan {
/// Kind of normalization pattern detected
#[derive(Debug, Clone, PartialEq, Eq)]
#[allow(dead_code)]
pub enum PlanKind {
/// Phase 131: loop(true) { ... break } alone
///
@ -66,6 +67,7 @@ impl NormalizationPlan {
note = "Use loop_only() instead. Statement-level normalization makes this obsolete."
)]
#[allow(deprecated)]
#[allow(dead_code)]
pub fn loop_with_post(post_assign_count: usize) -> Self {
// consumed = 1 (loop) + N (assigns) + 1 (return)
let consumed = 1 + post_assign_count + 1;

View File

@ -75,6 +75,7 @@ pub(in crate::mir::builder) enum ScanDirection {
/// This structure contains all the information needed to lower an index_of-style loop.
/// Moved from pattern6_scan_with_init.rs for centralization.
#[derive(Debug, Clone)]
#[allow(dead_code)]
pub(in crate::mir::builder) struct ScanWithInitPlan {
/// Loop variable name (e.g., "i")
pub loop_var: String,
@ -335,6 +336,7 @@ pub(in crate::mir::builder) struct Pattern5InfiniteEarlyExitPlan {
/// CorePlan expressions use **ValueId references only** (no String parsing).
/// This prevents "second language processor" from growing inside Lowerer.
#[derive(Debug, Clone)]
#[allow(dead_code)]
pub(in crate::mir::builder) enum CorePlan {
/// Sequence: execute plans in order
Seq(Vec<CorePlan>),
@ -370,6 +372,7 @@ pub(in crate::mir::builder) struct CorePhiInfo {
/// All fields are now REQUIRED (Option removed for structural SSOT).
/// Legacy fields (header_effects, step_effects, carriers) have been removed.
#[derive(Debug, Clone)]
#[allow(dead_code)]
pub(in crate::mir::builder) struct CoreLoopPlan {
// === Block IDs (pre-allocated by Normalizer) ===
@ -478,6 +481,7 @@ pub(in crate::mir::builder) enum CoreEffectPlan {
/// Phase 273 P1: Exit plan (control flow exit)
#[derive(Debug, Clone)]
#[allow(dead_code)]
pub(in crate::mir::builder) enum CoreExitPlan {
/// Return with optional value
Return(Option<ValueId>),

View File

@ -92,11 +92,13 @@ impl CoreContext {
}
/// Peek at the next ValueId without consuming it
#[allow(dead_code)]
pub fn peek_next_value(&self) -> ValueId {
self.value_gen.peek_next()
}
/// Peek at the next BasicBlockId without consuming it
#[allow(dead_code)]
pub fn peek_next_block(&self) -> BasicBlockId {
self.block_gen.peek_next()
}

View File

@ -61,6 +61,7 @@ use crate::mir::{MirFunction, ValueId};
/// - `after_bb`: Post-loop block (no terminator)
/// - `cond_loop`: Loop condition value (i <= limit)
/// - `cond_match`: Match condition value (chunk == sep)
#[allow(dead_code)]
pub(in crate::mir::builder) fn emit_split_scan_edgecfg(
func: &mut MirFunction,
header_bb: BasicBlockId,

View File

@ -4,6 +4,7 @@ use super::super::{MirBuilder, MirType, ValueId};
/// - 優先: current_static_box静的ボックスの文脈
/// - 次点: 現在の関数名のプレフィックス("Class.method/Arity"
/// - それ以外: 付与せず(挙動不変)
#[allow(dead_code)]
pub(crate) fn annotate_me_origin(builder: &mut MirBuilder, me_id: ValueId) {
let mut cls: Option<String> = None;
if let Some(c) = builder.comp_ctx.current_static_box.clone() {

View File

@ -91,30 +91,35 @@ impl ScopeContext {
/// Push loop header block
#[inline]
#[allow(dead_code)]
pub(super) fn push_loop_header(&mut self, bb: BasicBlockId) {
self.loop_header_stack.push(bb);
}
/// Pop loop header block
#[inline]
#[allow(dead_code)]
pub(super) fn pop_loop_header(&mut self) -> Option<BasicBlockId> {
self.loop_header_stack.pop()
}
/// Get innermost loop header
#[inline]
#[allow(dead_code)]
pub(super) fn current_loop_header(&self) -> Option<BasicBlockId> {
self.loop_header_stack.last().copied()
}
/// Push loop exit block
#[inline]
#[allow(dead_code)]
pub(super) fn push_loop_exit(&mut self, bb: BasicBlockId) {
self.loop_exit_stack.push(bb);
}
/// Pop loop exit block
#[inline]
#[allow(dead_code)]
pub(super) fn pop_loop_exit(&mut self) -> Option<BasicBlockId> {
self.loop_exit_stack.pop()
}

View File

@ -34,6 +34,7 @@ pub(crate) struct TypeContext {
pub value_origin_newbox: BTreeMap<ValueId, String>,
}
#[allow(dead_code)]
impl TypeContext {
/// Create a new empty TypeContext
pub fn new() -> Self {

View File

@ -77,6 +77,7 @@ impl Default for VariableContext {
}
}
#[allow(dead_code)]
impl VariableContext {
/// Create a new VariableContext with empty variable_map
pub fn new() -> Self {

View File

@ -10,6 +10,7 @@ pub(in crate::mir::builder) struct LexicalScopeFrame {
}
impl LexicalScopeFrame {
#[allow(dead_code)]
fn new() -> Self {
Self::default()
}

View File

@ -36,6 +36,7 @@ use crate::mir::ValueId;
/// # Returns
///
/// ValueId of the computed update result (the dst of Select)
#[allow(dead_code)]
pub fn emit_conditional_step_update(
carrier: &CarrierVar,
cond_ast: &ASTNode,

View File

@ -28,6 +28,7 @@ pub struct BodyLocalDerivedRecipe {
/// Derived variable name to register into LoopBodyLocalEnv (e.g. "ch").
pub name: String,
/// Base init expression from `local name = <expr>` (diagnostics only; lowering is done elsewhere).
#[allow(dead_code)]
pub base_init_expr: ASTNode,
/// Escape condition evaluated on the *base* value (e.g. `ch == "\\"`).
pub escape_cond: ASTNode,
@ -48,6 +49,7 @@ pub struct BodyLocalDerivedRecipe {
#[derive(Debug, Clone, Copy)]
pub struct BodyLocalDerivedEmission {
/// ValueId of the escape condition (truthy) evaluated on the base body-local value.
#[allow(dead_code)]
pub escape_cond_id: ValueId,
/// ValueId of the loop counter next value (includes conditional pre-delta + post-delta).
pub loop_counter_next: ValueId,

View File

@ -17,6 +17,7 @@
use crate::ast::ASTNode;
use crate::mir::join_ir::lowering::error_tags;
#[allow(dead_code)]
#[derive(Debug, Clone)]
pub struct ReadOnlyBodyLocalSlot {
pub name: String,

View File

@ -53,6 +53,7 @@ use crate::mir::ValueId;
/// // Generates:
/// // out_next = BinOp(Add, out_param, ch_value)
/// ```
#[allow(dead_code)]
pub fn emit_string_concat(
target_id: ValueId,
rhs_id: ValueId,

View File

@ -54,6 +54,7 @@ use crate::mir::join_ir::{
/// # Returns
///
/// * `JoinModule` - Successfully lowered to JoinIR
#[allow(dead_code)]
pub(crate) fn lower_scan_bool_predicate_minimal(
join_value_space: &mut JoinValueSpace,
predicate_receiver: &str,

View File

@ -91,6 +91,7 @@ use crate::mir::join_ir::{
/// # Returns
///
/// * `JoinModule` - Successfully lowered to JoinIR
#[allow(dead_code)]
pub(crate) fn lower_scan_with_init_minimal(
join_value_space: &mut JoinValueSpace,
dynamic_needle: bool, // Phase 258 P0: true if substr.length(), false if fixed (ch)

View File

@ -80,6 +80,7 @@ use crate::mir::join_ir::{
/// # Returns
///
/// * `JoinModule` - Successfully lowered to JoinIR
#[allow(dead_code)]
pub(crate) fn lower_scan_with_init_reverse(
join_value_space: &mut JoinValueSpace,
) -> JoinModule {

View File

@ -102,6 +102,7 @@ use crate::mir::join_ir::{
/// # Returns
///
/// * `JoinModule` - Successfully lowered to JoinIR
#[allow(dead_code)]
pub(crate) fn lower_split_scan_minimal(
join_value_space: &mut JoinValueSpace,
) -> JoinModule {

View File

@ -22,6 +22,8 @@
//!
//! Phase 27-shortterm scope: skip_ws で green 化できれば成功
#![allow(dead_code)]
use crate::backend::VMError;
use crate::mir::join_ir::JoinFuncId;

View File

@ -9,6 +9,7 @@ use nyash_rust::mir::MirModule;
/// **Responsibility**: Emit LLVM object file if requested
/// **Input**: &MirModule
/// **Output**: Result<bool, String> (Ok(true) if emitted, Ok(false) if not requested, Err on failure)
#[allow(dead_code)]
pub struct ObjectEmitterBox;
impl ObjectEmitterBox {
@ -56,6 +57,7 @@ impl ObjectEmitterBox {
}
#[cfg(not(feature = "llvm-harness"))]
#[allow(dead_code)]
pub fn try_emit(_module: &MirModule) -> Result<bool, String> {
Ok(false)
}

View File

@ -10,6 +10,7 @@ use std::path::PathBuf;
#[derive(Debug, Clone)]
pub struct PluginErrorContext {
pub kind: PluginErrorKind,
#[allow(dead_code)]
pub plugin_name: String,
pub message: String,
pub attempted_paths: Vec<String>,
@ -24,8 +25,10 @@ pub enum PluginErrorKind {
/// dlopen() failed
LoadFailed,
/// Plugin initialization failed
#[allow(dead_code)]
InitFailed,
/// Version mismatch
#[allow(dead_code)]
VersionMismatch,
}
@ -75,6 +78,7 @@ impl PluginErrorContext {
}
/// Create error context for init failure
#[allow(dead_code)]
pub fn init_failed(plugin_name: &str, error_msg: &str) -> Self {
Self {
kind: PluginErrorKind::InitFailed,