code: def test_domain_c_ast_attributes():
      # style: C++
      check("member", "[[]] int f", {1: "f"})
      check(
          "member",
          "[ [ ] ] int f",
          {1: "f"},
          # this will fail when the proper grammar is implemented
          output="[[ ]] int f",
      )
      check("member", "[[a]] int f", {1: "f"})
      # style: GNU
      check("member", "__attribute__(()) int f", {1: "f"})
      check("member", "__attribute__((a)) int f", {1: "f"})
      check("member", "__attribute__((a, b)) int f", {1: "f"})
      check("member", "__attribute__((optimize(3))) int f", {1: "f"})
      check(
          "member",
          "__attribute__((format(printf, 1, 2))) int f",
          {1: "f"},
      )
      # style: user-defined id
      check("member", "id_attr int f", {1: "f"})
      # style: user-defined paren
      check("member", "paren_attr() int f", {1: "f"})
      check("member", "paren_attr(a) int f", {1: "f"})
      check("member", 'paren_attr("") int f', {1: "f"})
      check("member", "paren_attr(()[{}][]{}) int f", {1: "f"})
      with pytest.raises(DefinitionError):
          parse("member", "paren_attr(() int f")
      with pytest.raises(DefinitionError):
          parse("member", "paren_attr([) int f")
      with pytest.raises(DefinitionError):
          parse("member", "paren_attr({) int f")
      with pytest.raises(DefinitionError):
          parse("member", "paren_attr([)]) int f")
      with pytest.raises(DefinitionError):
          parse("member", "paren_attr((])) int f")
      with pytest.raises(DefinitionError):
          parse("member", "paren_attr({]}) int f")
  
      # position: decl specs
      check(
          "function",
          "static inline __attribute__(()) void f()",
          {1: "f"},
          output="__attribute__(()) static inline void f()",
      )
      check("function", "[[attr1]] [[attr2]] void f()", {1: "f"})
      # position: declarator
      check("member", "int *[[attr1]] [[attr2]] i", {1: "i"})
      check(
          "member",
          "int *const [[attr1]] [[attr2]] volatile i",
          {1: "i"},
          output="int *[[attr1]] [[attr2]] volatile const i",
      )
      check("member", "int *[[attr1]] [[attr2]] *i", {1: "i"})
      # position: parameters
      check("function", "void f() [[attr1]] [[attr2]]", {1: "f"})
  
      # position: enumerator
      check("enumerator", "{key}Foo [[attr1]] [[attr2]]", {1: "Foo"})
      check(
          "enumerator", "{key}Foo [[attr1]] [[attr2]] = 42", {1: "Foo"}
      )
  
      # issue michaeljones/breathe#500
      check(
          "function",
          "LIGHTGBM_C_EXPORT int LGBM_BoosterFree(int handle)",
          {1: "LGBM_BoosterFree"},
      )
  
imports: import itertools
  import zlib
  from xml.etree import ElementTree
  import pytest
  from sphinx import addnodes
  from sphinx.addnodes import desc, desc_content, desc_name, desc_parameter, desc_parameterlist, desc_sig_name, desc_sig_space, desc_signature, desc_signature_line, pending_xref
  from sphinx.domains.c import DefinitionError, DefinitionParser, Symbol, _id_prefix, _macroKeywords, _max_id
  from sphinx.ext.intersphinx import load_mappings, normalize_intersphinx_mapping
  from sphinx.testing import restructuredtext
  from sphinx.testing.util import assert_node
  from sphinx.writers.text import STDINDENT
label_desc: Use image node_id 16 for calling a global function with example usage: test_domain_c_ast_attributes() without return types