void-packages/srcpkgs/clucene/patches/clucene-gcc-atomics.patch
Đoàn Trần Công Danh c987560802 srcpkgs/c*: convert patches to -Np1
```sh
git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
	for p in ${template%/template}/patches/*; do
		sed -i '
			\,^[+-][+-][+-] /dev/null,b
			/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
			s,^[*][*][*] ,&a/,
			/^--- /{
				s,\(^--- \)\(./\)*,\1a/,
				s,[.][Oo][Rr][Ii][Gg]\([	/]\),\1,
				s/[.][Oo][Rr][Ii][Gg]$//
				s/[.]patched[.]\([^.]\)/.\1/
				h
			}
			/^+++ -/{
				g
				s/^--- a/+++ b/
				b
			}
			s,\(^+++ \)\(./\)*,\1b/,
		' "$p"
	done
	sed -i '/^patch_args=/d' $template
done
```
2021-06-20 13:17:29 +07:00

32 lines
1.3 KiB
Diff

--- a/src/shared/CLucene/config/threads.cpp 2012-02-23 12:06:55.355506304 +0000
+++ b/src/shared/CLucene/config/threads.cpp 2012-02-23 12:07:17.131766381 +0000
@@ -185,7 +185,7 @@
}
int32_t atomic_threads::atomic_increment(_LUCENE_ATOMIC_INT *theInteger){
- #ifdef _CL_HAVE_GCC_ATOMIC_FUNCTIONS
+ #if ( __GNUC__ > 4 ) || (( __GNUC__ == 4) && ( __GNUC_MINOR__ >= 4 ))
return __sync_add_and_fetch(theInteger, 1);
#else
SCOPED_LOCK_MUTEX(theInteger->THIS_LOCK)
@@ -193,7 +193,7 @@
#endif
}
int32_t atomic_threads::atomic_decrement(_LUCENE_ATOMIC_INT *theInteger){
- #ifdef _CL_HAVE_GCC_ATOMIC_FUNCTIONS
+ #if ( __GNUC__ > 4 ) || (( __GNUC__ == 4) && ( __GNUC_MINOR__ >= 4 ))
return __sync_sub_and_fetch(theInteger, 1);
#else
SCOPED_LOCK_MUTEX(theInteger->THIS_LOCK)
--- a/src/shared/CLucene/LuceneThreads.h 2012-02-23 12:36:28.388299322 +0000
+++ b/src/shared/CLucene/LuceneThreads.h 2012-02-23 12:37:23.131885433 +0000
@@ -70,7 +70,7 @@
void NotifyAll();
};
- #ifdef _CL_HAVE_GCC_ATOMIC_FUNCTIONS
+ #if ( __GNUC__ > 4 ) || (( __GNUC__ == 4) && ( __GNUC_MINOR__ >= 4 ))
#define _LUCENE_ATOMIC_INT uint32_t
#define _LUCENE_ATOMIC_INT_SET(x,v) x=v
#define _LUCENE_ATOMIC_INT_GET(x) x