diff --git a/libavcodec/x86/dsputil_mmx.c b/libavcodec/x86/dsputil_mmx.c
index c1f54ac64f51452d76a7cb11704a75c03da68e60..4fbb146ccc0f43a4de059632c6f639fe25830d5e 100644
--- a/libavcodec/x86/dsputil_mmx.c
+++ b/libavcodec/x86/dsputil_mmx.c
@@ -2692,7 +2692,7 @@ static void dsputil_init_mmx2(DSPContext *c, AVCodecContext *avctx,
 #endif
             SET_QPEL_FUNCS(put_h264_qpel, 2, 4,  10_mmxext, ff_);
             SET_QPEL_FUNCS(avg_h264_qpel, 2, 4,  10_mmxext, ff_);
-#endif
+#endif /* HAVE_YASM */
         }
 
 #if HAVE_INLINE_ASM
@@ -2727,7 +2727,7 @@ static void dsputil_init_mmx2(DSPContext *c, AVCodecContext *avctx,
     } else {
         c->apply_window_int16 = ff_apply_window_int16_mmxext;
     }
-#endif
+#endif /* HAVE_YASM */
 }
 
 static void dsputil_init_3dnow(DSPContext *c, AVCodecContext *avctx,
@@ -2806,7 +2806,7 @@ static void dsputil_init_3dnow(DSPContext *c, AVCodecContext *avctx,
         c->avg_h264_chroma_pixels_tab[0] = ff_avg_h264_chroma_mc8_3dnow_rnd;
         c->avg_h264_chroma_pixels_tab[1] = ff_avg_h264_chroma_mc4_3dnow;
     }
-#endif
+#endif /* HAVE_YASM */
 }
 
 static void dsputil_init_3dnowext(DSPContext *c, AVCodecContext *avctx,
@@ -2852,7 +2852,7 @@ static void dsputil_init_sse(DSPContext *c, AVCodecContext *avctx, int mm_flags)
 #if HAVE_INLINE_ASM
     c->gmc = gmc_sse;
 #endif
-#endif
+#endif /* HAVE_YASM */
 }
 
 static void dsputil_init_sse2(DSPContext *c, AVCodecContext *avctx,
@@ -2920,7 +2920,7 @@ static void dsputil_init_sse2(DSPContext *c, AVCodecContext *avctx,
         c->apply_window_int16 = ff_apply_window_int16_sse2;
     }
     c->bswap_buf = ff_bswap32_buf_sse2;
-#endif
+#endif /* HAVE_YASM */
 }
 
 static void dsputil_init_ssse3(DSPContext *c, AVCodecContext *avctx,
diff --git a/libavcodec/x86/fmtconvert_init.c b/libavcodec/x86/fmtconvert_init.c
index 6f3d14aedc62c4ad58ca000e5942d4b3fdabcf3a..e781adbd4161a97f6adde852fda952bdc33414ae 100644
--- a/libavcodec/x86/fmtconvert_init.c
+++ b/libavcodec/x86/fmtconvert_init.c
@@ -110,7 +110,7 @@ static void float_interleave_sse(float *dst, const float **src,
     else
         ff_float_interleave_c(dst, src, len, channels);
 }
-#endif
+#endif /* HAVE_YASM */
 
 void ff_fmt_convert_init_x86(FmtConvertContext *c, AVCodecContext *avctx)
 {
@@ -143,5 +143,5 @@ void ff_fmt_convert_init_x86(FmtConvertContext *c, AVCodecContext *avctx)
             c->float_to_int16_interleave = float_to_int16_interleave_sse2;
         }
     }
-#endif
+#endif /* HAVE_YASM */
 }
diff --git a/libavcodec/x86/rv34dsp_init.c b/libavcodec/x86/rv34dsp_init.c
index b07ad89f0ed0f6f085d096c7039bc29d7513f1bd..de323e9c3c67e62a17b76a5ec1108ec78dc5a271 100644
--- a/libavcodec/x86/rv34dsp_init.c
+++ b/libavcodec/x86/rv34dsp_init.c
@@ -43,5 +43,5 @@ av_cold void ff_rv34dsp_init_x86(RV34DSPContext* c, DSPContext *dsp)
     }
     if (mm_flags & AV_CPU_FLAG_SSE4)
         c->rv34_idct_dc_add = ff_rv34_idct_dc_add_sse4;
-#endif
+#endif /* HAVE_YASM */
 }
diff --git a/libavcodec/x86/rv40dsp_init.c b/libavcodec/x86/rv40dsp_init.c
index cf52b41416e41d9630ad9915b1066ac7745ed18f..3541ddfb70a0ca5d5e8a4add8bb4a95d5784c6f9 100644
--- a/libavcodec/x86/rv40dsp_init.c
+++ b/libavcodec/x86/rv40dsp_init.c
@@ -234,5 +234,5 @@ void ff_rv40dsp_init_x86(RV34DSPContext *c, DSPContext *dsp)
         QPEL_MC_SET(put_, _ssse3)
         QPEL_MC_SET(avg_, _ssse3)
     }
-#endif
+#endif /* HAVE_YASM */
 }
diff --git a/libavcodec/x86/vc1dsp_mmx.c b/libavcodec/x86/vc1dsp_mmx.c
index f7ca714481491c1e4ce42ad7f1bd2ff79e119228..1bf06fa3b021a542b3c7ca7fc507e308e2f0d6f7 100644
--- a/libavcodec/x86/vc1dsp_mmx.c
+++ b/libavcodec/x86/vc1dsp_mmx.c
@@ -718,8 +718,7 @@ static void vc1_h_loop_filter16_sse4(uint8_t *src, int stride, int pq)
     ff_vc1_h_loop_filter8_sse4(src,          stride, pq);
     ff_vc1_h_loop_filter8_sse4(src+8*stride, stride, pq);
 }
-
-#endif
+#endif /* HAVE_YASM */
 
 void ff_put_vc1_chroma_mc8_mmx_nornd  (uint8_t *dst, uint8_t *src,
                                        int stride, int h, int x, int y);
@@ -822,5 +821,5 @@ void ff_vc1dsp_init_mmx(VC1DSPContext *dsp)
         dsp->vc1_h_loop_filter8  = ff_vc1_h_loop_filter8_sse4;
         dsp->vc1_h_loop_filter16 = vc1_h_loop_filter16_sse4;
     }
-#endif
+#endif /* HAVE_YASM */
 }
diff --git a/libavcodec/x86/vp8dsp_init.c b/libavcodec/x86/vp8dsp_init.c
index 04cfecca86893fa3cf379f798d2e194b6cb6035f..38ad0c7a0803e5e6fc331e5b6d657ffcf6e7f357 100644
--- a/libavcodec/x86/vp8dsp_init.c
+++ b/libavcodec/x86/vp8dsp_init.c
@@ -289,7 +289,7 @@ DECLARE_LOOP_FILTER(sse2)
 DECLARE_LOOP_FILTER(ssse3)
 DECLARE_LOOP_FILTER(sse4)
 
-#endif
+#endif /* HAVE_YASM */
 
 #define VP8_LUMA_MC_FUNC(IDX, SIZE, OPT) \
     c->put_vp8_epel_pixels_tab[IDX][0][2] = ff_put_vp8_epel ## SIZE ## _h6_ ## OPT; \
@@ -446,5 +446,5 @@ av_cold void ff_vp8dsp_init_x86(VP8DSPContext* c)
         c->vp8_h_loop_filter8uv       = ff_vp8_h_loop_filter8uv_mbedge_sse4;
 #endif
     }
-#endif
+#endif /* HAVE_YASM */
 }
diff --git a/libavresample/x86/audio_mix_init.c b/libavresample/x86/audio_mix_init.c
index de4c148170aa057ff64a574e4e7066c44c432512..1b472afc2fee557e82a575182baac9e1149137ab 100644
--- a/libavresample/x86/audio_mix_init.c
+++ b/libavresample/x86/audio_mix_init.c
@@ -210,5 +210,5 @@ av_cold void ff_audio_mix_init_x86(AudioMix *am)
     SET_MIX_3_8_TO_1_2(6)
     SET_MIX_3_8_TO_1_2(7)
     SET_MIX_3_8_TO_1_2(8)
-#endif
+#endif /* HAVE_YASM */
 }
diff --git a/libavutil/x86/cpu.c b/libavutil/x86/cpu.c
index 645bb83f770d6a6ddadc7574f5190c826f734989..9acc86755d68260647f842df7957faa056dc6998 100644
--- a/libavutil/x86/cpu.c
+++ b/libavutil/x86/cpu.c
@@ -144,8 +144,8 @@ int ff_get_cpu_flags_x86(void)
             if ((eax & 0x6) == 0x6)
                 rval |= AV_CPU_FLAG_AVX;
         }
-#endif
-#endif
+#endif /* HAVE_AVX */
+#endif /* HAVE_SSE */
     }
 
     cpuid(0x80000000, max_ext_level, ebx, ecx, edx);
diff --git a/libswscale/x86/swscale.c b/libswscale/x86/swscale.c
index 9683c0cedd8e857b967184b734d48400c8ca2911..db9fb732b908f7c5cf9f92aeb6414055c4332f94 100644
--- a/libswscale/x86/swscale.c
+++ b/libswscale/x86/swscale.c
@@ -395,7 +395,7 @@ switch(c->dstBpc){ \
     if (cpu_flags & AV_CPU_FLAG_MMXEXT) {
         ASSIGN_VSCALEX_FUNC(c->yuv2planeX, mmx2, , 1);
     }
-#endif
+#endif /* ARCH_X86_32 */
 #define ASSIGN_SSE_SCALE_FUNC(hscalefn, filtersize, opt1, opt2) \
     switch (filtersize) { \
     case 4:  ASSIGN_SCALE_FUNC2(hscalefn, 4, opt1, opt2); break; \