+/**
+ * Print microsoft extended declaration modifiers.
+ */
+static void print_ms_modifiers(const declaration_t *declaration) {
+ if((c_mode & _MS) == 0)
+ return;
+
+ decl_modifiers_t modifiers = declaration->modifiers;
+
+ /* DM_FORCEINLINE handled outside. */
+ if((modifiers & ~DM_FORCEINLINE) != 0 ||
+ declaration->alignment != 0 || declaration->deprecated != 0 ||
+ declaration->get_property_sym != NULL || declaration->put_property_sym != NULL) {
+ char *next = "(";
+
+ fputs("__declspec", out);
+ if(modifiers & DM_DLLIMPORT) {
+ fputs(next, out); next = ", "; fputs("dllimport", out);
+ }
+ if(modifiers & DM_DLLEXPORT) {
+ fputs(next, out); next = ", "; fputs("dllexport", out);
+ }
+ if(modifiers & DM_THREAD) {
+ fputs(next, out); next = ", "; fputs("thread", out);
+ }
+ if(modifiers & DM_NAKED) {
+ fputs(next, out); next = ", "; fputs("naked", out);
+ }
+ if(modifiers & DM_THREAD) {
+ fputs(next, out); next = ", "; fputs("thread", out);
+ }
+ if(modifiers & DM_SELECTANY) {
+ fputs(next, out); next = ", "; fputs("selectany", out);
+ }
+ if(modifiers & DM_NOTHROW) {
+ fputs(next, out); next = ", "; fputs("nothrow", out);
+ }
+ if(modifiers & DM_NORETURN) {
+ fputs(next, out); next = ", "; fputs("noreturn", out);
+ }
+ if(modifiers & DM_NOINLINE) {
+ fputs(next, out); next = ", "; fputs("noinline", out);
+ }
+ if(declaration->deprecated != 0) {
+ fputs(next, out); next = ", "; fputs("deprecated", out);
+ if(declaration->deprecated_string != NULL)
+ fprintf(out, "(\"%s\")", declaration->deprecated_string);
+ }
+ if(declaration->alignment != 0) {
+ fputs(next, out); next = ", "; fprintf(out, "align(%u)", declaration->alignment);
+ }
+ if(modifiers & DM_RESTRICT) {
+ fputs(next, out); next = ", "; fputs("restrict", out);
+ }
+ if(modifiers & DM_NOALIAS) {
+ fputs(next, out); next = ", "; fputs("noalias", out);
+ }
+ if(declaration->get_property_sym != NULL || declaration->put_property_sym != NULL) {
+ char *comma = "";
+ fputs(next, out); next = ", "; fprintf(out, "property(");
+ if(declaration->get_property_sym != NULL) {
+ fprintf(out, "get=%s", declaration->get_property_sym->string);
+ comma = ", ";
+ }
+ if(declaration->put_property_sym != NULL)
+ fprintf(out, "%sput=%s", comma, declaration->put_property_sym->string);
+ fputc(')', out);
+ }
+ fputs(") ", out);
+ }
+}
+