Question: With GCC & Clang you can deprecate `struct` members, (as shown below).

However I didn't see a way to do this for other compilers (MSVC for example).

While this isn't apart of the C spec and most likely relies on pragma's or custom extensions for each compiler, it would be useful to be able to support this across a wider range of compilers.

```
/* mytest.h */
#ifdef __GNUC__
#  define ATTR_DEPRECATED __attribute__((deprecated))
#else
#  define ATTR_DEPRECATED  /* unsupported compiler */
#endif

struct Test {
  int bar;
  int foo  ATTR_DEPRECATED;
};

```

Once a member is deprecated, the compiler should warn of its use if its accessed directly, eg:

```
#include "mytest.h"
static func(void)
{
    Test t;
    t.bar = 1;
    t.foo = 0;  /* <-- WARN ABOUT THIS AT COMPILE TIME */
}

```

Answer: 
Besides compilers which support GCC's `__attribute__((deprecated))` (Clang for example) there aren't conventions for MSVC to deprecate struct members (With MSVC you can deprecate the identifier but that applies globally, not just to that struct).

Also no other conventions for other C compilers have been posted. So it looks like this is GCC specific.
Perhaps something more along the lines of this:

```
#ifdef __GNUC__
    #define DEPRECATED(x) x __attribute__((deprecated))
#elif defined _MSC_VER
    #define DEPRECATED(x) __pragma deprecated(x)
#else
    #define DEPRECATED(x) x
#endif

```

edit: this is based on Quirliom's answer
2nd edit: fixed #pragma to be \_\_pragma as suggested by ideasman42