mirror of
https://https.git.savannah.gnu.org/git/patch.git
synced 2026-01-27 01:44:34 +00:00
Port to clang address sanitizer
* src/patch.c (FREE_BEFORE_EXIT): Port to clang, which uses __has_feature (address_sanitizer) instead of defined __SANITIZE_ADDRESS__. Also, rename this to SANITIZE_ADDRESS since it is really about -fsanitize=address rather than freeing before exit and as subsequent patches will show there are simpler ways to pacify -fsanitize=address. All uses changed.
This commit is contained in:
parent
e2e6820f71
commit
72a146cfaf
14
src/patch.c
14
src/patch.c
@ -30,10 +30,14 @@
|
||||
#include <xstdopen.h>
|
||||
#include <safe.h>
|
||||
|
||||
#ifdef __SANITIZE_ADDRESS__
|
||||
# define FREE_BEFORE_EXIT true
|
||||
#ifndef __has_feature
|
||||
# define __has_feature(a) false
|
||||
#endif
|
||||
|
||||
#if defined __SANITIZE_ADDRESS__ || __has_feature (address_sanitizer)
|
||||
# define SANITIZE_ADDRESS true
|
||||
#else
|
||||
# define FREE_BEFORE_EXIT false
|
||||
# define SANITIZE_ADDRESS false
|
||||
#endif
|
||||
|
||||
/* See common.h for the declarations of these variables. */
|
||||
@ -1801,7 +1805,7 @@ delete_files (void)
|
||||
removedirs (f->name);
|
||||
}
|
||||
next = f->next;
|
||||
if (FREE_BEFORE_EXIT)
|
||||
if (SANITIZE_ADDRESS)
|
||||
free (f);
|
||||
}
|
||||
}
|
||||
@ -1951,7 +1955,7 @@ output_files (struct stat const *st, int exiting)
|
||||
&& st->st_ino == from_st->st_ino);
|
||||
}
|
||||
|
||||
if (FREE_BEFORE_EXIT ? 0 <= exiting : !exiting)
|
||||
if (SANITIZE_ADDRESS ? 0 <= exiting : !exiting)
|
||||
{
|
||||
free (name);
|
||||
free (files_to_output);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user