Errno-like C global error handling
Error handling is indeed an issue in C with a multitude of potential handling mechanisms.  Good to see your take on it.


Allow for atomic error handling.  In addition to getting the error, it would be useful to have a test and clear to allow simpler error testing.  The point is that once upper level code tests positive for an error (the error is caught), the global test status should be immediately cleared (atomic) to allow for subsequent setting without a chance of intervening code messing up things.

bool err_test_and_clear(int *err) {
  // Simplistic code.  See also "C11 7.17 Atomics &lt;stdatomic.h&gt;" 
  if (err) {
    *err = error;
  }
  bool e = error != ERR_OK;
  error = ERR_OK;
  return e;
}

// usage
foo();
int err;
if (err_test_and_clear(&amp;err)) { 
  foo_clean_up();  // code may cause an error
  fprintf(stderr, "Error: %d\n", err);  // report original error
}


vs.

// usage
foo();
if (ERR) {
  foo_clean_up(); // code may cause error - oops this should have been after below 2
  int err = err_get();
  err_set(ERR_OK);
  fprintf(stderr, "Error: %d\n", err);  // report maybe original error
}

Not a fan of ERR, which looks like a constant or object and it is not.  Perhaps make it look like a function. Or be emphatic that ERR_OK is 0.

// #define ERR (err_get() != ERR_OK)

// better
#define ERR() (err_get() != ERR_OK)

// or best no define, just use `if(err_get())`

If code like if (err_get() != ERR_OK) is preferred over if (err_get()), then code should use 

// _Thread_local static int error;
_Thread_local static int error = ERR_OK;

Missing ,

enum err {
    ERR_OK    , // add ,
    ERR_SOME,
};

I'm leaning that _Thread_local static int error may benefit with being volatile.  Have to ponder that more.
For easier to read semantics, consider a clear function.  err_clear(); has more clarity than err_set(ERR_OK); ("setting the error" of "OK error").  Further ERR_OK looks contradictory.  Perhaps ERR_NONE?

void err_clear(void) {
  error = ERR_OK;
}

Mixed "types".  I'd expect both int or both enum err

             vvvvvvvv
void err_set(enum err e);
int err_get(void);
^^^