From 8d40f16a6021dc7fbba1bdc1bbda27ea1e955777 Mon Sep 17 00:00:00 2001
From: Petri Lehtinen <petri@digip.org>
Date: Sat, 19 Nov 2011 22:03:10 +0200
Subject: [PATCH] Issue #13338: Handle all enumerations in
 _Py_ANNOTATE_MEMORY_ORDER

This allows compiling extension modules with -Wswitch-enum on gcc.
Initial patch by Floris Bruynooghe.
---
 Include/pyatomic.h | 6 ++++--
 Misc/ACKS          | 1 +
 Misc/NEWS          | 4 ++++
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/Include/pyatomic.h b/Include/pyatomic.h
index b0028fd92f..da45327b89 100644
--- a/Include/pyatomic.h
+++ b/Include/pyatomic.h
@@ -64,7 +64,8 @@ _Py_ANNOTATE_MEMORY_ORDER(const volatile void *address, _Py_memory_order order)
     case _Py_memory_order_seq_cst:
         _Py_ANNOTATE_HAPPENS_BEFORE(address);
         break;
-    default:
+    case _Py_memory_order_relaxed:
+    case _Py_memory_order_acquire:
         break;
     }
     switch(order) {
@@ -73,7 +74,8 @@ _Py_ANNOTATE_MEMORY_ORDER(const volatile void *address, _Py_memory_order order)
     case _Py_memory_order_seq_cst:
         _Py_ANNOTATE_HAPPENS_AFTER(address);
         break;
-    default:
+    case _Py_memory_order_relaxed:
+    case _Py_memory_order_release:
         break;
     }
 }
diff --git a/Misc/ACKS b/Misc/ACKS
index a82e0c91ac..c66edb7ab1 100644
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -124,6 +124,7 @@ Gary S. Brown
 Oleg Broytmann
 Dave Brueck
 Francisco Martín Brugué
+Floris Bruynooghe
 Stan Bubrouski
 Erik de Bueger
 Dick Bulterman
diff --git a/Misc/NEWS b/Misc/NEWS
index 513984d6de..c3765dd973 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,10 @@ What's New in Python 3.2.3?
 Core and Builtins
 -----------------
 
+- Issue #13338: Handle all enumerations in _Py_ANNOTATE_MEMORY_ORDER
+  to allow compiling extension modules with -Wswitch-enum on gcc.
+  Initial patch by Floris Bruynooghe.
+
 - Issue #13333: The UTF-7 decoder now accepts lone surrogates (the encoder
   already accepts them).
 
-- 
2.40.0