Skip to main content

A C/C++ code instrumenter makes global variables static

Project description

make-globals-static is used in DEAD. It makes global variables and functions (except main) static.

To build just the clang tool

Prerequisites: cmake, make, clang/llvm 13/14.

mkdir build
cd build
cmake .. 
cmake --build . [--parallel]
cmake --install . --prefix=/where/to/install/

Usage

cat test.c
int b;
int foo(int a) {
    return a + b;
}

int main(){
    return foo(2);
}


make-globals-static test.c --


cat test.c 
static int b;
static int foo(int a) {
    return a + b;
}

int main(){
    return foo(2);
}

Python wrapper

pip install static-globals

To use the instrumenter in python import from static.instrumenter import annotate_with_static: def annotate_with_static( program: ProgramType) -> ProgramType

Building the python wrapper

Local build
./build_python_wheel_local.sh #this will build the current branch
pip install .

Docker based build

docker run --rm -e REVISION=REV -v `pwd`:/io theodort/manylinux-with-llvm:latest /io/build_python_wheel_docker.sh

This will build multiple wheels for REV with multiple python versions. The output is stored in the wheelhouse directory. The docker image is based on https://github.com/thetheodor/manylinux-with-llvm.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

static_globals-0.0.3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (21.5 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.27+ x86-64 manylinux: glibc 2.28+ x86-64

static_globals-0.0.3-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (21.5 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.27+ x86-64 manylinux: glibc 2.28+ x86-64

static_globals-0.0.3-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (21.5 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.27+ x86-64 manylinux: glibc 2.28+ x86-64

File details

Details for the file static_globals-0.0.3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for static_globals-0.0.3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 21cfd26a2669ab98a10ec4843bc865d5b660f3acad91ac78101f64760e7a5dd5
MD5 1218a9498f34e2d68cffa920d1d45253
BLAKE2b-256 742715040d8ff463f1c6f4236a9662e5094bdbf4f57050ca9e8322d8f69edf6f

See more details on using hashes here.

File details

Details for the file static_globals-0.0.3-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for static_globals-0.0.3-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0052aa72f97f90a01231c574451830e1fa83b24c2ef36efc9762c298046bac9b
MD5 e843073056e63e1abdae1db6da66a46a
BLAKE2b-256 a4d4ba55e6c51899e676a4bac4f12b8bb31229e5b0b5ef4ced6fa8abf85be17d

See more details on using hashes here.

File details

Details for the file static_globals-0.0.3-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for static_globals-0.0.3-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 27805d747bf69d91cbec2c48271a2ac8db89594dccb9f17074903228a1827a2b
MD5 f82a617f12ad19ef00f4b249286ba077
BLAKE2b-256 d71c2e9eaba6a8288d3b2090583b668a99fd3703e7ddd33c71ff533c76eb9d84

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page