Skip to content

Commit

Permalink
Make BindCPU a typedef instead of an enum to avoid undefined behavi…
Browse files Browse the repository at this point in the history
…or when we use non-negative values
  • Loading branch information
rocallahan committed Mar 7, 2024
1 parent 587e5cc commit e40cd03
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ class TraceFrame;
class RecordTask;
class ReplayTask;

typedef int BindCPU;

enum Completion { COMPLETE, INCOMPLETE };

/**
Expand Down Expand Up @@ -496,7 +498,7 @@ bool is_advanced_pc_and_signaled_instruction(Task* t, remote_code_ptr ip);
* UNBOUND_CPU means not binding to a particular CPU.
* A non-negative value means binding to the specific CPU number.
*/
enum BindCPU { BIND_CPU = -2, UNBOUND_CPU = -1 };
enum { BIND_CPU = -2, UNBOUND_CPU = -1 };

/* Get the path of the cpu lock file */
std::string get_cpu_lock_file();
Expand Down

0 comments on commit e40cd03

Please sign in to comment.