Skip to content

Commit

Permalink
disable C extgensions, remove xopen def
Browse files Browse the repository at this point in the history
  • Loading branch information
horta committed Nov 9, 2022
1 parent ad34f45 commit c1e5264
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v4.3.0
hooks:
- id: trailing-whitespace
- id: check-added-large-files
Expand Down
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.16.3 FATAL_ERROR)
project(
logaddexp
LANGUAGES C
VERSION 2.1.9)
VERSION 2.1.10)

set(LOGADDEXP_MAIN_PROJECT OFF)
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
Expand All @@ -22,6 +22,7 @@ message(STATUS "LOGADDEXP_MAIN_PROJECT: " ${LOGADDEXP_MAIN_PROJECT})
message(STATUS "LOGADDEXP_BUILD_TESTS: " ${LOGADDEXP_BUILD_TESTS})

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_C_EXTENSIONS OFF)

include(cmake/compiler-options.cmake)
include(cmake/sanitizers.cmake)
Expand Down
4 changes: 4 additions & 0 deletions include/logaddexp/logaddexp.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
#include <float.h>
#include <math.h>

#ifndef M_LN2
#define M_LN2 0.69314718055994530942 /* log_e 2 */
#endif

/* Computes ㏒ₑ(𝑒ˣ + 𝑒ʸ) in a safe and accurate way.
*
* For example, `log(exp(1e3) + exp(-INFINITY))` will likely overflow,
Expand Down
1 change: 0 additions & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ function(logaddexp_add_test name)
target_compile_options(${target} PRIVATE ${WARNING_FLAGS})
target_compile_definitions(${target} PRIVATE $<$<BOOL:${WIN32}>:_CRT_SECURE_NO_WARNINGS>)
target_compile_definitions(${target} PRIVATE $<$<BOOL:${WIN32}>:_CRT_NONSTDC_NO_DEPRECATE>)
target_compile_definitions(${target} PRIVATE _XOPEN_SOURCE=700)
add_test(NAME ${name} COMMAND ${target})
endfunction()

Expand Down

0 comments on commit c1e5264

Please sign in to comment.