patch 8.1.0785: depending on the configuration some functions are unused

Problem:    Depending on the configuration some functions are unused.
Solution:   Add more #ifdefs, remove unused functions. (Dominique Pelle,
            closes #3822)
diff --git a/src/syntax.c b/src/syntax.c
index 4e1d450..b48ca00 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -8887,6 +8887,7 @@
     return (table->ga_len - 1 + ATTR_OFF);
 }
 
+#if defined(FEAT_TERMINAL) || defined(PROTO)
 /*
  * Get an attribute index for a cterm entry.
  * Uses an existing entry when possible or adds one when needed.
@@ -8906,8 +8907,9 @@
     at_en.ae_u.cterm.bg_color = bg;
     return get_attr_entry(&cterm_attr_table, &at_en);
 }
+#endif
 
-#if defined(FEAT_TERMGUICOLORS) || defined(PROTO)
+#if (defined(FEAT_TERMINAL) && defined(FEAT_TERMGUICOLORS)) || defined(PROTO)
 /*
  * Get an attribute index for a 'termguicolors' entry.
  * Uses an existing entry when possible or adds one when needed.
@@ -8935,7 +8937,7 @@
 }
 #endif
 
-#if defined(FEAT_GUI) || defined(PROTO)
+#if (defined(FEAT_TERMINAL) && defined(FEAT_GUI)) || defined(PROTO)
 /*
  * Get an attribute index for a cterm entry.
  * Uses an existing entry when possible or adds one when needed.