Skip to content

Commit

Permalink
fix: supress unused warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Starry-OvO committed Jun 11, 2023
1 parent 025b2e4 commit 11bb8af
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 17 deletions.
2 changes: 1 addition & 1 deletion aiotieba/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "3.4.3"
__version__ = "3.4.4a0"
3 changes: 2 additions & 1 deletion aiotieba/helper/crypto/include/tbcrypto/sign.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include "tbcrypto/_python.h"
#include "tbcrypto/utils.h"

PyObject* sign(PyObject* self, PyObject* args);
PyObject* sign(PyObject* TBC_UNUSED self, PyObject* args);
10 changes: 3 additions & 7 deletions aiotieba/helper/crypto/include/tbcrypto/utils.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
#ifdef __has_attribute
#define TBC_HAS_ATTRIBUTE(x) __has_attribute(x)
#else
#define TBC_HAS_ATTRIBUTE(x) 0
#endif

#if TBC_HAS_ATTRIBUTE(noescape)
#if defined(__GNUC__) || defined(__clang__)
#define TBC_NOESCAPE __attribute__((noescape))
#define TBC_UNUSED __attribute__((unused))
#else
#define TBC_NOESCAPE
#define TBC_UNUSED __pragma(warning(suppress:4100))
#endif
7 changes: 4 additions & 3 deletions aiotieba/helper/crypto/src/tbcrypto/lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
#include "tbcrypto/cuid.h"
#include "tbcrypto/error.h"
#include "tbcrypto/sign.h"
#include "tbcrypto/utils.h"
#include "tbcrypto/zid.h"

PyObject* cuid_galaxy2(PyObject* self, PyObject* args)
PyObject* cuid_galaxy2(PyObject* TBC_UNUSED self, PyObject* args)
{
unsigned char dst[TBC_CUID_GALAXY2_SIZE];
const unsigned char* androidID;
Expand All @@ -27,7 +28,7 @@ PyObject* cuid_galaxy2(PyObject* self, PyObject* args)
return PyUnicode_FromKindAndData(PyUnicode_1BYTE_KIND, dst, TBC_CUID_GALAXY2_SIZE);
}

PyObject* c3_aid(PyObject* self, PyObject* args)
PyObject* c3_aid(PyObject* TBC_UNUSED self, PyObject* args)
{
unsigned char dst[TBC_C3_AID_SIZE];
const unsigned char* androidID;
Expand All @@ -54,7 +55,7 @@ PyObject* c3_aid(PyObject* self, PyObject* args)
return PyUnicode_FromKindAndData(PyUnicode_1BYTE_KIND, dst, TBC_C3_AID_SIZE);
}

PyObject* rc4_42(PyObject* self, PyObject* args)
PyObject* rc4_42(PyObject* TBC_UNUSED self, PyObject* args)
{
unsigned char dst[TBC_RC4_SIZE];
const unsigned char* xyusMd5Str;
Expand Down
3 changes: 2 additions & 1 deletion aiotieba/helper/crypto/src/tbcrypto/sign.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "rapidjson/itoa.h"

#include "tbcrypto/const.h"
#include "tbcrypto/utils.h"

#include "tbcrypto/sign.h"

Expand All @@ -21,7 +22,7 @@ static inline void __tbc_pyStr2UTF8(const char** dst, size_t* dstSize, PyObject*
}
}

PyObject* sign(PyObject* self, PyObject* args)
PyObject* sign(PyObject* TBC_UNUSED self, PyObject* args)
{
PyObject* items;
if (!PyArg_ParseTuple(args, "O", &items)) {
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def build_extensions(self):
include_dir = extension_dir / "include"
source_dir = extension_dir / "src"

source_files = glob.glob(str(extension_dir) + '/**/*.c', recursive=True)
source_files = glob.glob(f"{extension_dir}/**/*.c", recursive=True)

ext_crypto_module = Extension(
"aiotieba.helper.crypto.crypto",
Expand Down
6 changes: 3 additions & 3 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.[speedup]

# Test Suite
pytest==7.3.1
pytest-asyncio==0.21.0
pytest-rerunfailures==11.1.2
pytest
pytest-asyncio
pytest-rerunfailures

0 comments on commit 11bb8af

Please sign in to comment.