diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 6123210925632ea83b177432eacc65e1d847374f..0e59852eaefb530feb662bc6c1fdb007b74c4945 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -754,6 +754,10 @@ static const AVOption options[]={
 
 #undef A
 #undef V
+#undef S
+#undef E
+#undef D
+#undef DEFAULT
 
 static AVClass av_codec_context_class = { "AVCodecContext", context_to_name, options };
 
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 6348ac98dfa1b9ae2830b16f80e80fc917d78489..d9b57897dc83e5ca5189c18696bc2ceac06a6c8f 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -474,6 +474,10 @@ static const AVOption options[]={
 {NULL},
 };
 
+#undef E
+#undef D
+#undef DEFAULT
+
 static const AVClass av_format_context_class = { "AVFormatContext", format_to_name, options };
 
 #if LIBAVCODEC_VERSION_INT > ((52<<16)+(0<<8)+0)