Skip to content

Commit

Permalink
fix CI
Browse files Browse the repository at this point in the history
* Bump version to 6.0 (per semver check)
* Remove unused SIMD use statements
* hide a few warnings - these are TODOs, and should be fixed in separate PRs
* do NOT build SIMD as part of MSRV -- doesn't make any sense to combine nightly with MSRV
  • Loading branch information
nyurik authored and danielrh committed May 4, 2024
1 parent bf3db20 commit 8e0b2a8
Show file tree
Hide file tree
Showing 27 changed files with 12 additions and 41 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ jobs:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
if: github.event_name != 'release' && github.event_name != 'workflow_dispatch'
- name: Install nightly toolchain
run: rustup toolchain install nightly
- name: Run `just ci-test` to lint, build, and test everything
run: just ci-test
- name: Check if changes break public API and need a new version. Use `just semver-checks` to run locally.
Expand Down
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "brotli"
version = "5.0.0"
version = "6.0.0"
authors = ["Daniel Reiter Horn <danielrh@dropbox.com>", "The Brotli Authors"]
description = "A brotli compressor and decompressor that with an interface avoiding the rust stdlib. This makes it suitable for embedded devices and kernels. It is designed with a pluggable allocator so that the standard lib's allocator may be employed. The default build also includes a stdlib allocator and stream interface. Disable this with --features=no-stdlib. All included code is safe."
license = "BSD-3-Clause OR MIT"
Expand All @@ -11,6 +11,7 @@ keywords = ["brotli", "decompression", "lz77", "huffman", "nostd"]
categories = ["compression", "no-std"]
readme = "README.md"
autobins = false
edition = "2015"
rust-version = "1.56.0"

[[bin]]
Expand Down
4 changes: 4 additions & 0 deletions c/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ extern crate std;

pub extern crate brotli;
pub use brotli::ffi::compressor::*;

// FIXME: this is just wrong, and needs to be fixed
#[allow(unknown_lints, ambiguous_glob_reexports)]
pub use brotli::ffi::decompressor::*;

pub use brotli::ffi::multicompress::*;
pub use brotli::*;
use core::ptr::null_mut;
Expand Down
5 changes: 2 additions & 3 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ build-simd:

# Build the brotli-ffi crate (in ./c dir)
build-ffi:
# TODO change to this: RUSTFLAGS='-D warnings' cargo build --workspace --all-targets --bins --tests --lib --benches --examples --manifest-path c/Cargo.toml
cargo build --workspace --all-targets --bins --tests --lib --benches --examples --manifest-path c/Cargo.toml
RUSTFLAGS='-D warnings' cargo build --workspace --all-targets --bins --tests --lib --benches --examples --manifest-path c/Cargo.toml
# For now, use original make file for building/testing the FFI crate
cd c && make

Expand Down Expand Up @@ -72,7 +71,7 @@ read-msrv:
ci-test: sys-info (fmt "--check") build test test-doc

# All stable tests to run for CI with the earliest supported Rust version. Assumes the Rust version is already set by rustup.
ci-test-msrv: sys-info build test
ci-test-msrv: sys-info build-brotli build-ffi test

# Test if changes are backwards compatible (patch), or need a new minor/major version
semver-checks:
Expand Down
1 change: 0 additions & 1 deletion src/bin/util.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use core::marker::PhantomData;
use core::mem;
use std;
use std::thread::JoinHandle;

use alloc_no_stdlib::{Allocator, SliceWrapper};
Expand Down
2 changes: 0 additions & 2 deletions src/enc/bit_cost.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
use super::super::alloc::SliceWrapper;
use super::histogram::CostAccessors;
use core::cmp::{max, min};
#[cfg(feature = "simd")]
use core::simd::prelude::SimdPartialOrd;

use super::util::{FastLog2, FastLog2u16};
use super::vectorization::Mem256i;
Expand Down
1 change: 0 additions & 1 deletion src/enc/block_split.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![allow(dead_code)]
use super::super::alloc;
use super::super::alloc::Allocator;
use super::super::alloc::SliceWrapper;

Expand Down
2 changes: 0 additions & 2 deletions src/enc/block_splitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
use super::backward_references::BrotliEncoderParams;
use super::vectorization::{sum8i, v256, v256i, Mem256f};

use super::super::alloc;
use super::super::alloc::{Allocator, SliceWrapper, SliceWrapperMut};
use super::bit_cost::BrotliPopulationCost;
use super::block_split::BlockSplit;
Expand All @@ -13,7 +12,6 @@ use super::histogram::{
HistogramClear, HistogramCommand, HistogramDistance, HistogramLiteral,
};
use super::util::FastLog2;
use core;
use core::cmp::{max, min};
#[cfg(feature = "simd")]
use core::simd::prelude::{SimdFloat, SimdPartialOrd};
Expand Down
2 changes: 0 additions & 2 deletions src/enc/cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ use super::histogram::{
CostAccessors, HistogramAddHistogram, HistogramClear, HistogramSelfAddHistogram,
};
use super::util::FastLog2;
use alloc;
use alloc::{Allocator, SliceWrapper, SliceWrapperMut};
use core;
use core::cmp::min;
#[derive(Clone, Copy)]
pub struct HistogramPair {
Expand Down
1 change: 0 additions & 1 deletion src/enc/compress_fragment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use super::brotli_bit_stream::{BrotliBuildAndStoreHuffmanTreeFast, BrotliStoreHu
// the hoops that BuildAndStoreCommandPrefixCode goes through are subtly different in order
// (eg memcpy x+24, y instead of +24, y+40
// pretty much assume compress_fragment_two_pass is a trap! except for BrotliStoreMetaBlockHeader
use super::super::alloc;
use super::compress_fragment_two_pass::{memcpy, BrotliStoreMetaBlockHeader, BrotliWriteBits};
use super::entropy_encode::{
BrotliConvertBitDepthsToSymbols, BrotliCreateHuffmanTree, HuffmanTree,
Expand Down
3 changes: 0 additions & 3 deletions src/enc/compress_fragment_two_pass.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#![allow(dead_code)]
use super::backward_references::kHashMul32;
//use super::super::alloc::{SliceWrapper, SliceWrapperMut};
use super::super::alloc;
use super::bit_cost::BitsEntropy;
use super::brotli_bit_stream::{BrotliBuildAndStoreHuffmanTreeFast, BrotliStoreHuffmanTree};
use super::entropy_encode::{
Expand All @@ -12,7 +10,6 @@ use super::static_dict::{
BROTLI_UNALIGNED_STORE64,
};
use super::util::Log2FloorNonZero;
use core;
use core::cmp::min;
static kCompressFragmentTwoPassBlockSize: usize = (1i32 << 17) as usize;

Expand Down
2 changes: 0 additions & 2 deletions src/enc/context_map_entropy.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
use super::super::alloc;
use super::super::alloc::{Allocator, SliceWrapper, SliceWrapperMut};
use super::find_stride;
use super::input_pair::{InputPair, InputReference, InputReferenceMut};
use super::interface;
pub use super::ir_interpret::{push_base, Context, IRInterpreter};
use super::util::{floatX, FastLog2u16};
use super::weights::{Weights, BLEND_FIXED_POINT_PRECISION};
use core;

const DEFAULT_CM_SPEED_INDEX: usize = 8;
const NUM_SPEEDS_TO_TRY: usize = 16;
Expand Down
2 changes: 0 additions & 2 deletions src/enc/encode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ use super::interface;
pub use super::parameters::BrotliEncoderParameter;
use alloc::Allocator;

use super::super::alloc;
use super::super::alloc::{SliceWrapper, SliceWrapperMut};
use super::command::{BrotliDistanceParams, Command, GetLengthCode};
use super::compress_fragment::BrotliCompressFragmentFast;
Expand All @@ -44,7 +43,6 @@ use super::metablock::{
use super::static_dict::{kNumDistanceCacheEntries, BrotliGetDictionary};
use super::utf8_util::BrotliIsMostlyUTF8;
use super::util::Log2FloorNonZero;
use core;
use core::cmp::{max, min};
use enc::input_pair::InputReferenceMut;
//fn BrotliCreateHqZopfliBackwardReferences(m: &mut [MemoryManager],
Expand Down
1 change: 0 additions & 1 deletion src/enc/find_stride.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use super::super::alloc;
use super::super::alloc::{SliceWrapper, SliceWrapperMut};
use super::input_pair::{InputPair, InputReference};
use super::interface;
Expand Down
1 change: 0 additions & 1 deletion src/enc/fixed_queue.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use core;
pub const MAX_THREADS: usize = 16;

pub struct FixedQueue<T: Sized> {
Expand Down
2 changes: 0 additions & 2 deletions src/enc/histogram.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
#![allow(dead_code)]

use super::super::alloc;
use super::super::alloc::{SliceWrapper, SliceWrapperMut};
use super::block_split::BlockSplit;
use super::command::Command;
use super::constants::{kSigned3BitContextLookup, kUTF8ContextLookup};
use super::vectorization::Mem256i;
use core;
use core::cmp::min;
static kBrotliMinWindowBits: i32 = 10i32;

Expand Down
1 change: 0 additions & 1 deletion src/enc/input_pair.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use super::super::alloc::SliceWrapper;
use super::super::alloc::SliceWrapperMut;
use super::interface::Freezable;
use core;
use core::cmp::min;
#[derive(Copy, Clone, Default, Debug)]
pub struct InputReference<'a> {
Expand Down
2 changes: 0 additions & 2 deletions src/enc/metablock.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![allow(dead_code)]
use super::super::alloc;
use super::super::alloc::{Allocator, SliceWrapper, SliceWrapperMut};
use super::backward_references::BrotliEncoderParams;
use super::bit_cost::{BitsEntropy, BrotliPopulationCost};
Expand All @@ -20,7 +19,6 @@ use super::histogram::{
HistogramAddHistogram, HistogramAddItem, HistogramClear, HistogramCommand, HistogramDistance,
HistogramLiteral,
};
use core;
use core::cmp::{max, min};

pub fn BrotliInitDistanceParams(params: &mut BrotliEncoderParams, npostfix: u32, ndirect: u32) {
Expand Down
2 changes: 0 additions & 2 deletions src/enc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ pub mod singlethreading;
pub mod threading;
pub mod worker_pool;
#[cfg(feature = "simd")]
use core::simd::{f32x8, i16x16, i32x8};
#[cfg(feature = "simd")]
pub type s16 = core::simd::i16x16;
#[cfg(feature = "simd")]
pub type v8 = core::simd::f32x8;
Expand Down
1 change: 0 additions & 1 deletion src/enc/multithreading.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use enc::threading::{
};
use enc::BrotliAlloc;
use enc::BrotliEncoderParams;
use std;
use std::thread::JoinHandle;

// in-place thread create
Expand Down
2 changes: 2 additions & 0 deletions src/enc/pdf.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
//TODO: replace with builtin SIMD type

// FIXME!!!
#[allow(dead_code)]
#[derive(Copy, Clone, Default, Debug)]
pub struct PDF([i16; 16]);
2 changes: 0 additions & 2 deletions src/enc/prior_eval.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use super::super::alloc;
use super::super::alloc::{Allocator, SliceWrapper, SliceWrapperMut};
use super::backward_references::BrotliEncoderParams;
use super::find_stride;
Expand All @@ -7,7 +6,6 @@ use super::interface;
use super::ir_interpret::{push_base, IRInterpreter};
use super::util::{floatX, FastLog2u16};
use super::{s16, v8};
use core;
use core::cmp::min;
#[cfg(feature = "simd")]
use core::simd::prelude::SimdPartialOrd;
Expand Down
2 changes: 0 additions & 2 deletions src/enc/singlethreading.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ use enc::threading::{
};
use enc::BrotliAlloc;
use enc::BrotliEncoderParams;
#[cfg(feature = "std")]
use std;

pub struct SingleThreadedJoinable<T: Send + 'static, U: Send + 'static> {
result: Result<T, U>,
Expand Down
2 changes: 0 additions & 2 deletions src/enc/stride_eval.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
use super::super::alloc;
use super::super::alloc::{Allocator, SliceWrapper, SliceWrapperMut};
use super::backward_references::BrotliEncoderParams;
use super::input_pair::{InputPair, InputReference, InputReferenceMut};
use super::interface;
use super::ir_interpret::{push_base, IRInterpreter};
use super::prior_eval::DEFAULT_SPEED;
use super::util::{floatX, FastLog2u16};
use core;
const NIBBLE_PRIOR_SIZE: usize = 16;
pub const STRIDE_PRIOR_SIZE: usize = 256 * 256 * NIBBLE_PRIOR_SIZE * 2;

Expand Down
2 changes: 0 additions & 2 deletions src/enc/threading.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ use core::marker::PhantomData;
use core::mem;
use core::ops::Range;
use enc::encode::BrotliEncoderStateStruct;
#[cfg(feature = "std")]
use std;

pub type PoisonedThreadError = ();

Expand Down
2 changes: 0 additions & 2 deletions src/enc/vectorization.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#![allow(unknown_lints)]
#![allow(unused_macros)]

#[cfg(feature = "simd")]
use core::simd::Simd;
use enc::util::FastLog2;
use enc::{s8, v8};
pub type Mem256f = v8;
Expand Down
1 change: 0 additions & 1 deletion src/enc/worker_pool.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![cfg(feature = "std")]
use core::mem;
use std;

use alloc::{Allocator, SliceWrapper};
use enc::backward_references::UnionHasher;
Expand Down

0 comments on commit 8e0b2a8

Please sign in to comment.